+static int AvgAdc_Voltage_HF(void)
+{
+ int AvgAdc_Voltage_Low, AvgAdc_Voltage_High;
+
+ AvgAdc_Voltage_Low= (MAX_ADC_HF_VOLTAGE_LOW * AvgAdc(ADC_CHAN_HF_LOW)) >> 10;
+ // if voltage range is about to be exceeded, use high voltage ADC channel if available (RDV40 only)
+ if (AvgAdc_Voltage_Low > MAX_ADC_HF_VOLTAGE_LOW - 300) {
+ AvgAdc_Voltage_High = (MAX_ADC_HF_VOLTAGE_HIGH * AvgAdc(ADC_CHAN_HF_HIGH)) >> 10;
+ if (AvgAdc_Voltage_High >= AvgAdc_Voltage_Low) {
+ return AvgAdc_Voltage_High;
+ }
+ }
+ return AvgAdc_Voltage_Low;
+}
+
+static int AvgAdc_Voltage_LF(void)
+{
+ return (MAX_ADC_LF_VOLTAGE * AvgAdc(ADC_CHAN_LF)) >> 10;
+}
+