mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-03-16 08:29:15 +01:00
LP-480 CopterControl will expect ADC_Init() only if board revision has analog gyro, so be prepared to get NULL from PIOS_BOARD_HW_DEFS_GetAdcCfg()
This commit is contained in:
parent
83326eaca3
commit
1548312823
@ -185,16 +185,19 @@ void PIOS_BOARD_Sensors_Configure()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PIOS_INCLUDE_ADC
|
#ifdef PIOS_INCLUDE_ADC
|
||||||
PIOS_ADC_Init(PIOS_BOARD_HW_DEFS_GetAdcCfg(pios_board_info_blob.board_rev));
|
const struct pios_adc_cfg *adc_cfg = PIOS_BOARD_HW_DEFS_GetAdcCfg(pios_board_info_blob.board_rev);
|
||||||
#ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
if(adc_cfg) {
|
||||||
uint8_t adc_config[HWSETTINGS_ADCROUTING_NUMELEM];
|
PIOS_ADC_Init(adc_cfg);
|
||||||
HwSettingsADCRoutingArrayGet(adc_config);
|
# ifndef PIOS_EXCLUDE_ADVANCED_FEATURES
|
||||||
for (uint32_t i = 0; i < HWSETTINGS_ADCROUTING_NUMELEM; i++) {
|
uint8_t adc_config[HWSETTINGS_ADCROUTING_NUMELEM];
|
||||||
if (adc_config[i] != HWSETTINGS_ADCROUTING_DISABLED) {
|
HwSettingsADCRoutingArrayGet(adc_config);
|
||||||
PIOS_ADC_PinSetup(i);
|
for (uint32_t i = 0; i < HWSETTINGS_ADCROUTING_NUMELEM; i++) {
|
||||||
|
if (adc_config[i] != HWSETTINGS_ADCROUTING_DISABLED) {
|
||||||
|
PIOS_ADC_PinSetup(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#endif /* PIOS_INCLUDE_ADC */
|
#endif /* PIOS_INCLUDE_ADC */
|
||||||
|
|
||||||
// internal bmp280 baro
|
// internal bmp280 baro
|
||||||
|
Loading…
x
Reference in New Issue
Block a user