adc: introduce external adc channels

This commit is contained in:
Andrey Gusakov 2024-05-05 15:55:03 +03:00 committed by rusefillc
parent fe3b6eb26b
commit 6b265dd4f8
2 changed files with 23 additions and 1 deletions

View File

@ -34,7 +34,20 @@ typedef enum __attribute__ ((__packed__)) {
EFI_ADC_30 = 31,
EFI_ADC_31 = 32,
EFI_ADC_TOTAL_CHANNELS = 33, // Please keep this in sync with the last valid channel index!
// External ADC channels
EFI_ADC_32 = 33,
EFI_ADC_33 = 34,
EFI_ADC_34 = 35,
EFI_ADC_35 = 36,
EFI_ADC_36 = 37,
EFI_ADC_37 = 38,
EFI_ADC_38 = 39,
EFI_ADC_39 = 40,
EFI_ADC_TOTAL_CHANNELS = 41, // Please keep this in sync with the last valid channel index!
EFI_ADC_ERROR = 50,
} adc_channel_e;
/* Please keep updating these define(s) */
#define EFI_ADC_ONCHIP_LAST EFI_ADC_31

View File

@ -30,6 +30,15 @@ inline bool isAdcChannelValid(adc_channel_e hwChannel) {
return ((hwChannel > EFI_ADC_NONE) && (hwChannel < EFI_ADC_TOTAL_CHANNELS));
}
inline bool isAdcChannelOnChip(adc_channel_e hwChannel) {
return (isAdcChannelValid(hwChannel) && (hwChannel <= EFI_ADC_ONCHIP_LAST));
}
inline bool isAdcChannelOffChip(adc_channel_e hwChannel) {
return (isAdcChannelValid(hwChannel) && (hwChannel > EFI_ADC_ONCHIP_LAST));
}
#if !defined(GPT_FREQ_FAST) || !defined(GPT_PERIOD_FAST)
/**
* 8000 RPM is 133Hz