Skip to content

Commit

Permalink
AP_HAL_ChibiOS: Use correct pin config for ADC2 and ADC3
Browse files Browse the repository at this point in the history
  • Loading branch information
haydendonald authored and bugobliterator committed Jan 23, 2024
1 parent 1ec61c5 commit 3a53a65
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libraries/AP_HAL_ChibiOS/AnalogIn.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,16 +150,16 @@ float AnalogSource::_pin_scaler(void)
}
#ifdef HAL_ANALOG2_PINS
for (uint8_t i=0; i<ADC2_GRP1_NUM_CHANNELS; i++) {
if (AnalogIn::pin_config[i].analog_pin == _pin && (_pin != ANALOG_INPUT_NONE)) {
scaling = AnalogIn::pin_config[i].scaling;
if (AnalogIn::pin_config_2[i].analog_pin == _pin && (_pin != ANALOG_INPUT_NONE)) {
scaling = AnalogIn::pin_config_2[i].scaling;
break;
}
}
#endif
#ifdef HAL_ANALOG3_PINS
for (uint8_t i=0; i<ADC3_GRP1_NUM_CHANNELS; i++) {
if (AnalogIn::pin_config[i].analog_pin == _pin && (_pin != ANALOG_INPUT_NONE)) {
scaling = AnalogIn::pin_config[i].scaling;
if (AnalogIn::pin_config_3[i].analog_pin == _pin && (_pin != ANALOG_INPUT_NONE)) {
scaling = AnalogIn::pin_config_3[i].scaling;
break;
}
}
Expand Down

0 comments on commit 3a53a65

Please sign in to comment.