|
3 | 3 | #if defined(STM32F1xx)
|
4 | 4 |
|
5 | 5 | #include "../../../../communication/SimpleFOCDebug.h"
|
| 6 | +#include "../stm32_adc_utils.h" |
6 | 7 | #define _TRGO_NOT_AVAILABLE 12345
|
7 | 8 |
|
8 |
| -// timer to injected TRGO |
9 |
| -// https://github.com/stm32duino/Arduino_Core_STM32/blob/e156c32db24d69cb4818208ccc28894e2f427cfa/system/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h#L215 |
10 |
| -uint32_t _timerToInjectedTRGO(TIM_HandleTypeDef* timer){ |
11 |
| - if(timer->Instance == TIM1) |
12 |
| - return ADC_EXTERNALTRIGINJECCONV_T1_TRGO; |
13 |
| -#ifdef TIM2 // if defined timer 2 |
14 |
| - else if(timer->Instance == TIM2) |
15 |
| - return ADC_EXTERNALTRIGINJECCONV_T2_TRGO; |
16 |
| -#endif |
17 |
| -#ifdef TIM4 // if defined timer 4 |
18 |
| - else if(timer->Instance == TIM4) |
19 |
| - return ADC_EXTERNALTRIGINJECCONV_T4_TRGO; |
20 |
| -#endif |
21 |
| -#ifdef TIM5 // if defined timer 5 |
22 |
| - else if(timer->Instance == TIM5) |
23 |
| - return ADC_EXTERNALTRIGINJECCONV_T5_TRGO; |
24 |
| -#endif |
25 |
| - else |
26 |
| - return _TRGO_NOT_AVAILABLE; |
27 |
| -} |
28 |
| - |
29 |
| -// timer to regular TRGO |
30 |
| -// https://github.com/stm32duino/Arduino_Core_STM32/blob/e156c32db24d69cb4818208ccc28894e2f427cfa/system/Drivers/STM32F1xx_HAL_Driver/Inc/stm32f1xx_hal_adc_ex.h#L215 |
31 |
| -uint32_t _timerToRegularTRGO(TIM_HandleTypeDef* timer){ |
32 |
| - if(timer->Instance == TIM3) |
33 |
| - return ADC_EXTERNALTRIGCONV_T3_TRGO; |
34 |
| -#ifdef TIM8 // if defined timer 8 |
35 |
| - else if(timer->Instance == TIM8) |
36 |
| - return ADC_EXTERNALTRIGCONV_T8_TRGO; |
37 |
| -#endif |
38 |
| - else |
39 |
| - return _TRGO_NOT_AVAILABLE; |
40 |
| -} |
41 |
| - |
42 | 9 | ADC_HandleTypeDef hadc;
|
43 | 10 |
|
44 | 11 | /**
|
|
0 commit comments