Skip to content

Commit

Permalink
Enable ADC periph clock before initialising channels
Browse files Browse the repository at this point in the history
  • Loading branch information
raphaelcoeffic committed Oct 29, 2022
1 parent df8e001 commit 1fac872
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions radio/src/targets/common/arm/stm32/stm32_hal_adc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,6 @@ static void adc_setup_scan_mode(ADC_TypeDef* ADCx, uint8_t nconv)
// ADC must be disabled for the functions used here
LL_ADC_Disable(ADCx);

// enable periph clock
adc_enable_clock(ADCx);

LL_ADC_InitTypeDef adcInit;
LL_ADC_StructInit(&adcInit);

Expand Down Expand Up @@ -282,6 +279,9 @@ bool stm32_hal_adc_init(const stm32_adc_t* ADCs, uint8_t n_ADC,
uint8_t nconv = adc->n_channels;
if (nconv > 0) {

// enable periph clock
adc_enable_clock(adc->ADCx);

// configure each channel
const uint8_t* chan = adc->channels;
nconv = adc_init_channels(adc, inputs, chan, nconv);
Expand Down

0 comments on commit 1fac872

Please sign in to comment.