Skip to content

Commit d283f2a

Browse files
committed
Injected rank check bugfix
1 parent 0b7e25b commit d283f2a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/current_sense/hardware_specific/stm32/stm32_adc_utils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ uint32_t _initTimerInterruptDownsampling(Stm32CurrentSenseParams* cs_params, STM
446446

447447
// returns 0 if no downsampling is needed, 1 if downsampling is needed, 2 if error
448448
uint8_t _handleInjectedConvCpltCallback(ADC_HandleTypeDef *AdcHandle, Stm32AdcInterruptConfig& adc_interrupt_config, uint32_t adc_val[4]) {
449-
#ifndef HAL_ADCEx_InjectedGetValue
449+
#ifndef ADC_INJECTED_RANK_1
450450
return 0; // error: function not available
451451
#else
452452

@@ -469,7 +469,7 @@ uint8_t _handleInjectedConvCpltCallback(ADC_HandleTypeDef *AdcHandle, Stm32AdcIn
469469
// returns the voltage
470470
// if the pin is not found in the current sense parameters, returns 0
471471
float _readADCInjectedChannelVoltage(int pin, void* cs_params, Stm32AdcInterruptConfig& adc_interrupt_config, uint32_t adc_val[4]) {
472-
#ifndef HAL_ADCEx_InjectedGetValue
472+
#ifndef ADC_INJECTED_RANK_1
473473
return 0; // error: function not available
474474
#else
475475

src/current_sense/hardware_specific/stm32/stm32g4/stm32g4_mcu.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ void* _driverSyncLowSide(void* _driver_params, void* _cs_params){
112112
HAL_ADCEx_InjectedStart_IT(cs_params->adc_handle);
113113
}else{
114114
HAL_ADCEx_InjectedStart(cs_params->adc_handle);
115+
115116
}
116117

117118
// restart all the timers of the driver
@@ -133,8 +134,7 @@ float _readADCVoltageLowSide(const int pin, const void* cs_params){
133134
extern "C" {
134135
void HAL_ADCEx_InjectedConvCpltCallback(ADC_HandleTypeDef *AdcHandle){
135136
uint8_t adc_index = (uint8_t)_adcToIndex(AdcHandle);
136-
_handleInjectedConvCpltCallback(AdcHandle, adc_interrupt_config[adc_index], adc_val[adc_index]);
137+
_handleInjectedConvCpltCallback(AdcHandle, adc_interrupt_config[adc_index], adc_val[adc_index]);
137138
}
138139
}
139-
140140
#endif

0 commit comments

Comments
 (0)