Skip to content

Commit

Permalink
Fix when no injected ADC
Browse files Browse the repository at this point in the history
  • Loading branch information
Candas1 committed Mar 22, 2024
1 parent 9c3b732 commit 1825d10
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/current_sense/hardware_specific/stm32/stm32_adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,9 @@ int _start_ADCs(int use_adc_interrupt){
if(_calibrate_ADC(adc_handles[i]) == -1) return -1;

int adc_index = _adcToIndex(adc_handles[i]);


// Only if Injected ADC is available
#ifdef ADC_INJECTED_SOFTWARE_START
if (adc_inj_channel_count[adc_index] > 0){
// There are injected adc channels to be sampled
if (use_adc_interrupt && // if interrupt is required
Expand All @@ -558,6 +560,7 @@ int _start_ADCs(int use_adc_interrupt){
if(_start_inj_ADC(adc_handles[i]) == -1) return -1;
}
}
#endif

// Start DMA only if there are regular channels to be sampled on this ADC
if (adc_reg_channel_count[adc_index] > 0){
Expand Down

0 comments on commit 1825d10

Please sign in to comment.