1#include "../stm32_adc_utils.h"
3#if defined(STM32G4xx) && !defined(ARDUINO_B_G431B_ESC1)
7uint32_t _timerToInjectedTRGO(TIM_HandleTypeDef* timer){
8 if(timer->Instance == TIM1)
9 return ADC_EXTERNALTRIGINJEC_T1_TRGO;
11 else if(timer->Instance == TIM2)
12 return ADC_EXTERNALTRIGINJEC_T2_TRGO;
15 else if(timer->Instance == TIM3)
16 return ADC_EXTERNALTRIGINJEC_T3_TRGO;
19 else if(timer->Instance == TIM4)
20 return ADC_EXTERNALTRIGINJEC_T4_TRGO;
23 else if(timer->Instance == TIM6)
24 return ADC_EXTERNALTRIGINJEC_T6_TRGO;
27 else if(timer->Instance == TIM7)
28 return ADC_EXTERNALTRIGINJEC_T7_TRGO;
31 else if(timer->Instance == TIM8)
32 return ADC_EXTERNALTRIGINJEC_T8_TRGO;
35 else if(timer->Instance == TIM15)
36 return ADC_EXTERNALTRIGINJEC_T15_TRGO;
39 else if(timer->Instance == TIM20)
40 return ADC_EXTERNALTRIGINJEC_T20_TRGO;
43 return _TRGO_NOT_AVAILABLE;
48uint32_t _timerToRegularTRGO(TIM_HandleTypeDef* timer){
49 if(timer->Instance == TIM1)
50 return ADC_EXTERNALTRIG_T1_TRGO;
52 else if(timer->Instance == TIM2)
53 return ADC_EXTERNALTRIG_T2_TRGO;
56 else if(timer->Instance == TIM3)
57 return ADC_EXTERNALTRIG_T3_TRGO;
60 else if(timer->Instance == TIM4)
61 return ADC_EXTERNALTRIG_T4_TRGO;
64 else if(timer->Instance == TIM6)
65 return ADC_EXTERNALTRIG_T6_TRGO;
68 else if(timer->Instance == TIM7)
69 return ADC_EXTERNALTRIG_T7_TRGO;
72 else if(timer->Instance == TIM8)
73 return ADC_EXTERNALTRIG_T7_TRGO;
76 else if(timer->Instance == TIM15)
77 return ADC_EXTERNALTRIG_T15_TRGO;
80 else if(timer->Instance == TIM20)
81 return ADC_EXTERNALTRIG_T20_TRGO;
84 return _TRGO_NOT_AVAILABLE;