5#if defined(_STM32_DEF_) || defined(TARGET_STM32H7)
8void stm32_pauseTimer(TIM_HandleTypeDef* handle){
11 LL_TIM_DisableCounter(handle->Instance);
18void stm32_resumeTimer(TIM_HandleTypeDef* handle){
19 LL_TIM_EnableCounter(handle->Instance);
23void stm32_refreshTimer(TIM_HandleTypeDef* handle){
24 handle->Instance->EGR = TIM_EVENTSOURCE_UPDATE;
28void stm32_pauseChannel(TIM_HandleTypeDef* handle, uint32_t llchannels){
29 LL_TIM_CC_DisableChannel(handle->Instance, llchannels);
33void stm32_resumeChannel(TIM_HandleTypeDef* handle, uint32_t llchannels){
34 LL_TIM_CC_EnableChannel(handle->Instance, llchannels);
44uint32_t stm32_setClockAndARR(TIM_HandleTypeDef* handle, uint32_t PWM_freq) {
46 uint32_t arr_value = 0;
47 uint32_t cycles = stm32_getTimerClockFreq(handle) / PWM_freq / 2;
48 uint32_t prescaler = (cycles / 0x10000) + 1;
49 LL_TIM_SetPrescaler(handle->Instance, prescaler - 1);
50 uint32_t ticks = cycles / prescaler;
52 arr_value = ticks - 1;
54 __HAL_TIM_SET_AUTORELOAD(handle, arr_value);
55 stm32_refreshTimer(handle);
69void stm32_setPwm(TIM_HandleTypeDef *timer, uint32_t channel, uint32_t value) {
72 case 1: timer->Instance->CCR1 = value;
break;
73 case 2: timer->Instance->CCR2 = value;
break;
74 case 3: timer->Instance->CCR3 = value;
break;
75 case 4: timer->Instance->CCR4 = value;
break;
76 #ifdef LL_TIM_CHANNEL_CH5
77 case 5: timer->Instance->CCR5 = value;
break;
79 #ifdef LL_TIM_CHANNEL_CH6
80 case 6: timer->Instance->CCR6 = value;
break;
87uint32_t stm32_getHALChannel(uint32_t channel) {
88 uint32_t return_value;
91 return_value = TIM_CHANNEL_1;
94 return_value = TIM_CHANNEL_2;
97 return_value = TIM_CHANNEL_3;
100 return_value = TIM_CHANNEL_4;
104 return_value = TIM_CHANNEL_5;
109 return_value = TIM_CHANNEL_6;
120uint32_t stm32_getLLChannel(PinMap* timer) {
121#if defined(TIM_CCER_CC1NE)
122 if (STM_PIN_INVERTED(timer->function)) {
123 switch (STM_PIN_CHANNEL(timer->function)) {
124 case 1:
return LL_TIM_CHANNEL_CH1N;
125 case 2:
return LL_TIM_CHANNEL_CH2N;
126 case 3:
return LL_TIM_CHANNEL_CH3N;
127#if defined(LL_TIM_CHANNEL_CH4N)
128 case 4:
return LL_TIM_CHANNEL_CH4N;
135 switch (STM_PIN_CHANNEL(timer->function)) {
136 case 1:
return LL_TIM_CHANNEL_CH1;
137 case 2:
return LL_TIM_CHANNEL_CH2;
138 case 3:
return LL_TIM_CHANNEL_CH3;
139 case 4:
return LL_TIM_CHANNEL_CH4;
140 #ifdef LL_TIM_CHANNEL_CH5
141 case 5:
return LL_TIM_CHANNEL_CH5;
143 #ifdef LL_TIM_CHANNEL_CH6
144 case 6:
return LL_TIM_CHANNEL_CH6;
154uint8_t stm32_countTimers(TIM_HandleTypeDef *timers[], uint8_t num_timers) {
156 for (
int i=1; i<num_timers; i++) {
157 if (timers[i] != NULL)
break;
159 for (
int j=0; j<i; j++) {
160 if (timers[i] == timers[j]) {
171uint8_t stm32_distinctTimers(TIM_HandleTypeDef* timers_in[], uint8_t num_timers, TIM_HandleTypeDef* timers_out[]) {
173 for (
int i=0; i<num_timers; i++) {
174 if (timers_in[i] == NULL)
continue;
176 for (
int j=0; j<count; j++) {
177 if (timers_in[i] == timers_out[j]) {
183 timers_out[count++] = timers_in[i];
190#if defined(STM32G4xx)
194int stm32_getInternalSourceTrigger(TIM_HandleTypeDef* master, TIM_HandleTypeDef* slave) {
195 TIM_TypeDef *TIM_master = master->Instance;
196 #if defined(TIM1) && defined(LL_TIM_TS_ITR0)
197 if (TIM_master == TIM1)
return LL_TIM_TS_ITR0;
199 #if defined(TIM2) && defined(LL_TIM_TS_ITR1)
200 else if (TIM_master == TIM2)
return LL_TIM_TS_ITR1;
202 #if defined(TIM3) && defined(LL_TIM_TS_ITR2)
203 else if (TIM_master == TIM3)
return LL_TIM_TS_ITR2;
205 #if defined(TIM4) && defined(LL_TIM_TS_ITR3)
206 else if (TIM_master == TIM4)
return LL_TIM_TS_ITR3;
208 #if defined(TIM5) && defined(LL_TIM_TS_ITR4)
209 else if (TIM_master == TIM5)
return LL_TIM_TS_ITR4;
211 #if defined(TIM8) && defined(LL_TIM_TS_ITR5)
212 else if (TIM_master == TIM8)
return LL_TIM_TS_ITR5;
216#elif defined(STM32F4xx) || defined(STM32F1xx) || defined(STM32L4xx) || defined(STM32F7xx) || defined(STM32H7xx) || defined(TARGET_STM32H7)
227int stm32_getInternalSourceTrigger(TIM_HandleTypeDef* master, TIM_HandleTypeDef* slave) {
229 TIM_TypeDef *TIM_master = master->Instance;
230 TIM_TypeDef *TIM_slave = slave->Instance;
231 #if defined(TIM1) && defined(LL_TIM_TS_ITR0)
232 if (TIM_master == TIM1){
234 if(TIM_slave == TIM2)
return LL_TIM_TS_ITR0;
237 else if(TIM_slave == TIM3)
return LL_TIM_TS_ITR0;
240 else if(TIM_slave == TIM4)
return LL_TIM_TS_ITR0;
243 else if(TIM_slave == TIM8)
return LL_TIM_TS_ITR0;
245 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
247 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR0;
250 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR0;
255 #if defined(TIM2) && defined(LL_TIM_TS_ITR1)
256 else if (TIM_master == TIM2){
258 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR1;
261 else if(TIM_slave == TIM3)
return LL_TIM_TS_ITR1;
264 else if(TIM_slave == TIM4)
return LL_TIM_TS_ITR1;
267 else if(TIM_slave == TIM8)
return LL_TIM_TS_ITR1;
269 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
271 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR1;
274 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR1;
278 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR0;
283 #if defined(TIM3) && defined(LL_TIM_TS_ITR2)
284 else if (TIM_master == TIM3){
286 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR2;
289 else if(TIM_slave == TIM2)
return LL_TIM_TS_ITR2;
292 else if(TIM_slave == TIM4)
return LL_TIM_TS_ITR2;
294 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
296 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR2;
299 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR2;
302 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR2;
306 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR1;
311 #if defined(TIM4) && defined(LL_TIM_TS_ITR3)
312 else if (TIM_master == TIM4){
314 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR3;
317 else if(TIM_slave == TIM2)
return LL_TIM_TS_ITR3;
320 else if(TIM_slave == TIM3)
return LL_TIM_TS_ITR3;
323 else if(TIM_slave == TIM8)
return LL_TIM_TS_ITR2;
326 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
328 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR3;
331 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR3;
334 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR3;
338 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR2;
344 else if (TIM_master == TIM5){
345 #if defined(STM32F4xx) || defined(STM32F1xx) || defined(STM32F7xx)
347 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR0;
350 else if(TIM_slave == TIM3)
return LL_TIM_TS_ITR2;
354 if(TIM_slave == TIM8)
return LL_TIM_TS_ITR3;
357 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
359 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR4;
362 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR4;
368 else if (TIM_master == TIM8){
370 if(TIM_slave==TIM2)
return LL_TIM_TS_ITR1;
373 else if(TIM_slave == TIM4)
return LL_TIM_TS_ITR3;
376 #if defined(STM32H7xx) || defined(TARGET_STM32H7)
378 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR1;
381 else if(TIM_slave == TIM23)
return LL_TIM_TS_ITR5;
384 else if(TIM_slave == TIM24)
return LL_TIM_TS_ITR5;
388 else if(TIM_slave == TIM5)
return LL_TIM_TS_ITR3;
393 #if defined(TIM15) && (defined(STM32L4xx) || defined(STM32H7xx) || defined(TARGET_STM32H7) )
394 else if (TIM_master == TIM15){
396 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR0;
399 if(TIM_slave == TIM3)
return LL_TIM_TS_ITR2;
403 #if defined(TIM23) && (defined(STM32H7xx) || defined(TARGET_STM32H7))
404 else if (TIM_master == TIM23){
406 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR12;
409 if(TIM_slave == TIM2)
return LL_TIM_TS_ITR12;
412 if(TIM_slave == TIM3)
return LL_TIM_TS_ITR12;
415 if(TIM_slave == TIM4)
return LL_TIM_TS_ITR12;
418 if(TIM_slave == TIM5)
return LL_TIM_TS_ITR12;
421 if(TIM_slave == TIM8)
return LL_TIM_TS_ITR12;
424 if(TIM_slave == TIM24)
return LL_TIM_TS_ITR12;
428 #if defined(TIM24) && (defined(STM32H7xx) || defined(TARGET_STM32H7))
429 else if (TIM_master == TIM24){
431 if(TIM_slave == TIM1)
return LL_TIM_TS_ITR13;
434 if(TIM_slave == TIM2)
return LL_TIM_TS_ITR13;
437 if(TIM_slave == TIM3)
return LL_TIM_TS_ITR13;
440 if(TIM_slave == TIM4)
return LL_TIM_TS_ITR13;
443 if(TIM_slave == TIM5)
return LL_TIM_TS_ITR13;
446 if(TIM_slave == TIM8)
return LL_TIM_TS_ITR13;
449 if(TIM_slave == TIM23)
return LL_TIM_TS_ITR13;
457int stm32_getInternalSourceTrigger(TIM_HandleTypeDef* master, TIM_HandleTypeDef* slave) {
489TIM_HandleTypeDef* stm32_alignTimers(TIM_HandleTypeDef *timers_in[], uint8_t num_timers_in) {
491 TIM_HandleTypeDef *timers[6];
492 int numTimers = stm32_distinctTimers(timers_in, num_timers_in, timers);
495 for (
int i=0; i<numTimers; i++) {
496 for (
int j=0; j<stm32_getNumMotorsUsed(); j++) {
497 STM32DriverParams*
params = stm32_getMotorUsed(j);
498 for (
int k=0; k<6; k++) {
499 if (
params->timers_handle[k] == NULL)
break;
500 if (
params->timers_handle[k] == timers[i]) {
501 #ifdef SIMPLEFOC_STM32_DEBUG
502 SIMPLEFOC_DEBUG(
"STM32-DRV: ERR: Timer already used by another motor: TIM", stm32_getTimerNumber(timers[i]->Instance));
513 #if defined(SIMPLEFOC_STM32_DEBUG) && !defined(SIMPLEFOC_DISABLE_DEBUG)
523 int16_t master_index = -1;
524 int triggerEvent = -1;
525 for (
int i=0; i<numTimers; i++) {
527 if(IS_TIM_MASTER_INSTANCE(timers[i]->Instance)) {
530 if(timers[i]->Instance->CR2 & LL_TIM_TRGO_UPDATE)
continue;
532 for (
int slave_i=0; slave_i<numTimers; slave_i++) {
533 if (i==slave_i)
continue;
535 triggerEvent = stm32_getInternalSourceTrigger(timers[i],timers[slave_i]);
536 if(triggerEvent == -1)
break;
538 if(triggerEvent == -1)
continue;
547 if (master_index == -1) {
548 #ifdef SIMPLEFOC_STM32_DEBUG
549 SIMPLEFOC_DEBUG(
"STM32-DRV: WARN: No master timer found, cannot align timers!");
552 #ifdef SIMPLEFOC_STM32_DEBUG
553 SIMPLEFOC_DEBUG(
"STM32-DRV: master timer: TIM", stm32_getTimerNumber(timers[master_index]->Instance));
557 LL_TIM_SetSlaveMode(timers[master_index]->Instance, LL_TIM_SLAVEMODE_DISABLED );
559 LL_TIM_SetTriggerOutput(timers[master_index]->Instance, LL_TIM_TRGO_ENABLE);
563 for (
int slave_index=0; slave_index < numTimers; slave_index++) {
564 if (slave_index == master_index)
566 #ifdef SIMPLEFOC_STM32_DEBUG
567 SIMPLEFOC_DEBUG(
"STM32-DRV: slave timer: TIM", stm32_getTimerNumber(timers[slave_index]->Instance));
570 uint32_t trigger = stm32_getInternalSourceTrigger(timers[master_index], timers[slave_index]);
574 LL_TIM_SetTriggerInput(timers[slave_index]->Instance, trigger);
578 LL_TIM_SetSlaveMode(timers[slave_index]->Instance, LL_TIM_SLAVEMODE_GATED);
581 for (
int i=0; i<numTimers; i++) {
582 stm32_refreshTimer(timers[i]);
583 if (i != master_index)
584 stm32_resumeTimer(timers[i]);
585 SIMPLEFOC_DEBUG(
"STM32-DRV: slave counter: ", (
int)timers[i]->Instance->CNT);
587 stm32_resumeTimer(timers[master_index]);
588 return timers[master_index];
593 for (
int i=0; i<numTimers; i++)
594 stm32_resumeTimer(timers[i]);
603uint32_t stm32_getTimerClockFreq(TIM_HandleTypeDef *handle) {
604#if defined(STM32MP1xx)
605 uint8_t timerClkSrc = getTimerClkSrc(handle->Instance);
606 uint64_t clkSelection = timerClkSrc == 1 ? RCC_PERIPHCLK_TIMG1 : RCC_PERIPHCLK_TIMG2;
607 return HAL_RCCEx_GetPeriphCLKFreq(clkSelection);
609 RCC_ClkInitTypeDef clkconfig = {};
610 uint32_t pFLatency = 0U;
611 uint32_t uwTimclock = 0U, uwAPBxPrescaler = 0U;
614 HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
615 switch (getTimerClkSrc(handle->Instance)) {
617 uwAPBxPrescaler = clkconfig.APB1CLKDivider;
618 uwTimclock = HAL_RCC_GetPCLK1Freq();
620#if !defined(STM32C0xx) && !defined(STM32F0xx) && !defined(STM32G0xx)
622 uwAPBxPrescaler = clkconfig.APB2CLKDivider;
623 uwTimclock = HAL_RCC_GetPCLK2Freq();
631#if defined(STM32H7xx) || defined(TARGET_STM32H7)
639 RCC_PeriphCLKInitTypeDef PeriphClkConfig = {};
640 HAL_RCCEx_GetPeriphCLKConfig(&PeriphClkConfig);
642 if (PeriphClkConfig.TIMPresSelection == RCC_TIMPRES_ACTIVATED) {
643 switch (uwAPBxPrescaler) {
652 uwTimclock = HAL_RCC_GetHCLKFreq();
662 switch (uwAPBxPrescaler) {
669 uwTimclock = HAL_RCC_GetHCLKFreq();
689#if defined(STM32F4xx) || defined(STM32F7xx)
690#if !defined(STM32F405xx) && !defined(STM32F415xx) &&\
691 !defined(STM32F407xx) && !defined(STM32F417xx)
692 RCC_PeriphCLKInitTypeDef PeriphClkConfig = {};
693 HAL_RCCEx_GetPeriphCLKConfig(&PeriphClkConfig);
695 if (PeriphClkConfig.TIMPresSelection == RCC_TIMPRES_ACTIVATED)
696 switch (uwAPBxPrescaler) {
702 uwTimclock = HAL_RCC_GetHCLKFreq();
711 switch (uwAPBxPrescaler) {
736void enableTimerClock(TIM_HandleTypeDef *htim) {
738#if defined(TIM1_BASE)
739 if (htim->Instance == TIM1) {
740 __HAL_RCC_TIM1_CLK_ENABLE();
743#if defined(TIM2_BASE)
744 if (htim->Instance == TIM2) {
745 __HAL_RCC_TIM2_CLK_ENABLE();
748#if defined(TIM3_BASE)
749 if (htim->Instance == TIM3) {
750 __HAL_RCC_TIM3_CLK_ENABLE();
753#if defined(TIM4_BASE)
754 if (htim->Instance == TIM4) {
755 __HAL_RCC_TIM4_CLK_ENABLE();
758#if defined(TIM5_BASE)
759 if (htim->Instance == TIM5) {
760 __HAL_RCC_TIM5_CLK_ENABLE();
763#if defined(TIM6_BASE)
764 if (htim->Instance == TIM6) {
765 __HAL_RCC_TIM6_CLK_ENABLE();
768#if defined(TIM7_BASE)
769 if (htim->Instance == TIM7) {
770 __HAL_RCC_TIM7_CLK_ENABLE();
773#if defined(TIM8_BASE)
774 if (htim->Instance == TIM8) {
775 __HAL_RCC_TIM8_CLK_ENABLE();
778#if defined(TIM9_BASE)
779 if (htim->Instance == TIM9) {
780 __HAL_RCC_TIM9_CLK_ENABLE();
783#if defined(TIM10_BASE)
784 if (htim->Instance == TIM10) {
785 __HAL_RCC_TIM10_CLK_ENABLE();
788#if defined(TIM11_BASE)
789 if (htim->Instance == TIM11) {
790 __HAL_RCC_TIM11_CLK_ENABLE();
793#if defined(TIM12_BASE)
794 if (htim->Instance == TIM12) {
795 __HAL_RCC_TIM12_CLK_ENABLE();
798#if defined(TIM13_BASE)
799 if (htim->Instance == TIM13) {
800 __HAL_RCC_TIM13_CLK_ENABLE();
803#if defined(TIM14_BASE)
804 if (htim->Instance == TIM14) {
805 __HAL_RCC_TIM14_CLK_ENABLE();
808#if defined(TIM15_BASE)
809 if (htim->Instance == TIM15) {
810 __HAL_RCC_TIM15_CLK_ENABLE();
813#if defined(TIM16_BASE)
814 if (htim->Instance == TIM16) {
815 __HAL_RCC_TIM16_CLK_ENABLE();
818#if defined(TIM17_BASE)
819 if (htim->Instance == TIM17) {
820 __HAL_RCC_TIM17_CLK_ENABLE();
823#if defined(TIM18_BASE)
824 if (htim->Instance == TIM18) {
825 __HAL_RCC_TIM18_CLK_ENABLE();
828#if defined(TIM19_BASE)
829 if (htim->Instance == TIM19) {
830 __HAL_RCC_TIM19_CLK_ENABLE();
833#if defined(TIM20_BASE)
834 if (htim->Instance == TIM20) {
835 __HAL_RCC_TIM20_CLK_ENABLE();
838#if defined(TIM21_BASE)
839 if (htim->Instance == TIM21) {
840 __HAL_RCC_TIM21_CLK_ENABLE();
843#if defined(TIM22_BASE)
844 if (htim->Instance == TIM22) {
845 __HAL_RCC_TIM22_CLK_ENABLE();
851uint8_t getTimerClkSrc(TIM_TypeDef *tim) {
854 if (tim != (TIM_TypeDef *)NC)
855#if defined(STM32C0xx) || defined(STM32F0xx) || defined(STM32G0xx)
861 #
if defined(TIM2_BASE)
864 #
if defined(TIM3_BASE)
867 #
if defined(TIM4_BASE)
870 #
if defined(TIM5_BASE)
873 #
if defined(TIM6_BASE)
876 #
if defined(TIM7_BASE)
879 #
if defined(TIM12_BASE)
882 #
if defined(TIM13_BASE)
885 #
if defined(TIM14_BASE)
888 #
if defined(TIM18_BASE)
895 #
if defined(TIM1_BASE)
898 #
if defined(TIM8_BASE)
901 #
if defined(TIM9_BASE)
904 #
if defined(TIM10_BASE)
907 #
if defined(TIM11_BASE)
910 #
if defined(TIM15_BASE)
913 #
if defined(TIM16_BASE)
916 #
if defined(TIM17_BASE)
919 #
if defined(TIM19_BASE)
922 #
if defined(TIM20_BASE)
925 #
if defined(TIM21_BASE)
928 #
if defined(TIM22_BASE)
949#if defined(SIMPLEFOC_STM32_DEBUG) && !defined(SIMPLEFOC_DISABLE_DEBUG)
955int stm32_getTimerNumber(TIM_TypeDef *instance) {
956 #if defined(TIM1_BASE)
957 if (instance==TIM1)
return 1;
959 #if defined(TIM2_BASE)
960 if (instance==TIM2)
return 2;
962 #if defined(TIM3_BASE)
963 if (instance==TIM3)
return 3;
965 #if defined(TIM4_BASE)
966 if (instance==TIM4)
return 4;
968 #if defined(TIM5_BASE)
969 if (instance==TIM5)
return 5;
971 #if defined(TIM6_BASE)
972 if (instance==TIM6)
return 6;
974 #if defined(TIM7_BASE)
975 if (instance==TIM7)
return 7;
977 #if defined(TIM8_BASE)
978 if (instance==TIM8)
return 8;
980 #if defined(TIM9_BASE)
981 if (instance==TIM9)
return 9;
983 #if defined(TIM10_BASE)
984 if (instance==TIM10)
return 10;
986 #if defined(TIM11_BASE)
987 if (instance==TIM11)
return 11;
989 #if defined(TIM12_BASE)
990 if (instance==TIM12)
return 12;
992 #if defined(TIM13_BASE)
993 if (instance==TIM13)
return 13;
995 #if defined(TIM14_BASE)
996 if (instance==TIM14)
return 14;
998 #if defined(TIM15_BASE)
999 if (instance==TIM15)
return 15;
1001 #if defined(TIM16_BASE)
1002 if (instance==TIM16)
return 16;
1004 #if defined(TIM17_BASE)
1005 if (instance==TIM17)
return 17;
1007 #if defined(TIM18_BASE)
1008 if (instance==TIM18)
return 18;
1010 #if defined(TIM19_BASE)
1011 if (instance==TIM19)
return 19;
1013 #if defined(TIM20_BASE)
1014 if (instance==TIM20)
return 20;
1016 #if defined(TIM21_BASE)
1017 if (instance==TIM21)
return 21;
1019 #if defined(TIM22_BASE)
1020 if (instance==TIM22)
return 22;
1026void stm32_printTimerCombination(
int numPins, PinMap* timers[],
int score) {
1027 for (
int i=0; i<numPins; i++) {
1028 if (timers[i] == NULL)
1035 if (STM_PIN_INVERTED(timers[i]->function))
#define SIMPLEFOC_DEBUG(msg,...)
static void print(const char *msg)
GenericCurrentSenseParams * params