diff --git a/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_hal.cpp b/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_hal.cpp index ced24e0e0..d4060441b 100644 --- a/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_hal.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_hal.cpp @@ -190,7 +190,7 @@ int _adc_gpio_init(Stm32CurrentSenseParams* cs_params, const int pinA, const int return 0; } - +#ifndef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK extern "C" { void ADC1_2_IRQHandler(void) { @@ -207,5 +207,6 @@ extern "C" { } #endif } +#endif #endif \ No newline at end of file diff --git a/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_mcu.cpp b/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_mcu.cpp index 7b0e90248..b06e609b1 100644 --- a/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_mcu.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32f1/stm32f1_mcu.cpp @@ -61,6 +61,10 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){ if(tim_interrupt) { // error in the timer interrupt initialization SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used"); + #ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK + SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!"); + return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED; + #endif } // set the trigger output event diff --git a/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_hal.cpp b/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_hal.cpp index 216819dbe..78b3327a5 100644 --- a/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_hal.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_hal.cpp @@ -194,6 +194,7 @@ int _adc_gpio_init(Stm32CurrentSenseParams* cs_params, const int pinA, const int return 0; } +#ifndef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK extern "C" { void ADC_IRQHandler(void) { @@ -203,5 +204,5 @@ extern "C" { } } } - +#endif #endif \ No newline at end of file diff --git a/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_mcu.cpp b/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_mcu.cpp index 7bace501a..8baf585fb 100644 --- a/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_mcu.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32f4/stm32f4_mcu.cpp @@ -61,6 +61,10 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){ if(tim_interrupt) { // error in the timer interrupt initialization SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used"); + #ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK + SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!"); + return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED; + #endif } // set the trigger output event diff --git a/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.cpp b/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.cpp index 7879f145f..9dfc29246 100644 --- a/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_hal.cpp @@ -246,7 +246,7 @@ int _adc_gpio_init(Stm32CurrentSenseParams* cs_params, const int pinA, const int return 0; } - +#ifndef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK extern "C" { void ADC1_2_IRQHandler(void) { @@ -279,4 +279,5 @@ extern "C" { } #endif } +#endif #endif \ No newline at end of file diff --git a/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp b/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp index 68b501480..2d83748e2 100644 --- a/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp @@ -64,6 +64,10 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){ if(tim_interrupt) { // error in the timer interrupt initialization SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used"); + #ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK + SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!"); + return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED; + #endif } // set the trigger output event diff --git a/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_hal.cpp b/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_hal.cpp index c7f65f86f..711a48c3b 100644 --- a/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_hal.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_hal.cpp @@ -227,7 +227,7 @@ int _adc_gpio_init(Stm32CurrentSenseParams* cs_params, const int pinA, const int return 0; } - +#ifndef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK extern "C" { void ADC_IRQHandler(void) { @@ -247,5 +247,6 @@ extern "C" { } } #endif +#endif #endif \ No newline at end of file diff --git a/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_mcu.cpp b/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_mcu.cpp index 31f2c16be..ef7e77912 100644 --- a/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_mcu.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32h7/stm32h7_mcu.cpp @@ -62,6 +62,10 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){ if(tim_interrupt) { // error in the timer interrupt initialization SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used"); + #ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK + SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!"); + return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED; + #endif } diff --git a/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_hal.cpp b/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_hal.cpp index 3a9639b4e..026cfb465 100644 --- a/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_hal.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_hal.cpp @@ -245,6 +245,7 @@ int _adc_gpio_init(Stm32CurrentSenseParams* cs_params, const int pinA, const int return 0; } +#ifndef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK extern "C" { void ADC1_2_IRQHandler(void) { @@ -277,5 +278,6 @@ extern "C" { } #endif } +#endif #endif \ No newline at end of file diff --git a/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_mcu.cpp b/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_mcu.cpp index 9bd4a33f2..93a7f89b9 100644 --- a/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_mcu.cpp +++ b/src/current_sense/hardware_specific/stm32/stm32l4/stm32l4_mcu.cpp @@ -63,6 +63,10 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){ if(tim_interrupt) { // error in the timer interrupt initialization SIMPLEFOC_DEBUG("STM32-CS: timer has no repetition counter, ADC interrupt has to be used"); + #ifdef SIMPLEFOC_STM32_ADC_DISABLE_RC_FALLBACK + SIMPLEFOC_DEBUG("STM32-CS: ERROR: Interrupts disabled!"); + return SIMPLEFOC_CURRENT_SENSE_INIT_FAILED; + #endif }