external muxes for internal ADC #3350
This commit is contained in:
parent
c6b154fc79
commit
b612c27917
|
@ -77,7 +77,14 @@ static AdcSubscriptionEntry* findEntry() {
|
|||
|
||||
#if EFI_PROD_CODE
|
||||
// Enable the input pin
|
||||
efiSetPadMode(name, getAdcChannelBrainPin(name, channel), PAL_MODE_INPUT_ANALOG);
|
||||
/**
|
||||
TODO: this code is similar to initIfValid, what is the plan? shall we extract helper method or else?
|
||||
*/
|
||||
brain_pin_e pin = getAdcChannelBrainPin(name, channel)
|
||||
if (pin != Gpio::Invalid) {
|
||||
// todo: external muxes for internal ADC #3350
|
||||
efiSetPadMode(name, pin, PAL_MODE_INPUT_ANALOG);
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
// if 0, default to the board's divider coefficient
|
||||
|
|
|
@ -90,7 +90,10 @@ brain_pin_e getAdcChannelBrainPin(const char *msg, adc_channel_e hwChannel) {
|
|||
case EFI_ADC_15:
|
||||
return Gpio::C5;
|
||||
default:
|
||||
/* todo: what is upper range ADC is used while lower range ADC is not used? how do we still mark pin used?
|
||||
external muxes for internal ADC #3350
|
||||
firmwareError(CUSTOM_ERR_ADC_UNKNOWN_CHANNEL, "Unknown hw channel %d [%s]", hwChannel, msg);
|
||||
*/
|
||||
return Gpio::Invalid;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,7 +16,15 @@ void initIfValid(const char* msg, adc_channel_e channel) {
|
|||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
/**
|
||||
TODO: this code is similar to AdcSubscription::SubscribeSensor, what is the plan? shall we extract helper method or else?
|
||||
*/
|
||||
|
||||
brain_pin_e pin = getAdcChannelBrainPin(msg, channel);
|
||||
if (pin == Gpio::Invalid) {
|
||||
// todo: external muxes for internal ADC #3350
|
||||
return;
|
||||
}
|
||||
efiSetPadMode(msg, pin, PAL_MODE_INPUT_ANALOG);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue