feat: support for HelloRadioSky V16 (#5317)

Co-authored-by: Peter Feerick <pfeerick@users.noreply.github.com>
This commit is contained in:
richardclli
2024-09-02 09:45:59 +10:00
committed by GitHub
co-authored by Peter Feerick
parent 4426f56cb9
commit 17bf9dc813
45 changed files with 1062 additions and 46 deletions
+13
View File
@@ -29,6 +29,10 @@ const etx_hal_adc_inputs_t* _hal_adc_inputs = nullptr;
static uint16_t adcValues[MAX_ANALOG_INPUTS] __DMA;
#if defined(CSD203_SENSOR)
extern uint16_t getCSD203BatteryVoltage(void);
#endif
bool adcInit(const etx_hal_adc_driver_t* driver)
{
// If there is an init function, it MUST succeed
@@ -243,6 +247,11 @@ uint16_t getRTCBatteryVoltage()
uint16_t getAnalogValue(uint8_t index)
{
if (index >= MAX_ANALOG_INPUTS) return 0;
#if defined(SIXPOS_SWITCH_INDEX) && !defined(SIMU)
if (index == SIXPOS_SWITCH_INDEX)
return getSixPosAnalogValue(adcValues[index]);
else
#endif
return adcValues[index];
}
@@ -297,6 +306,9 @@ tmr10ms_t jitterResetTime = 0;
uint16_t getBatteryVoltage()
{
#if defined(CSD203_SENSOR) && !defined(SIMU)
return getCSD203BatteryVoltage() / 10;
#else
// using filtered ADC value on purpose
if (adcGetMaxInputs(ADC_INPUT_VBAT) < 1) return 0;
int32_t instant_vbat = anaIn(adcGetInputOffset(ADC_INPUT_VBAT));
@@ -321,6 +333,7 @@ uint16_t getBatteryVoltage()
return (uint16_t)((instant_vbat * (1000 + g_eeGeneral.txVoltageCalibration)) /
BATTERY_DIVIDER);
#endif
#endif
}
static uint32_t apply_low_pass_filter(uint32_t v, uint32_t v_prev,