feat: preliminary HelloRadioSky V14 and V12 radio support (#5494)

This commit is contained in:
richardclli
2024-09-11 17:52:35 +10:00
committed by GitHub
parent 6e706c4b1c
commit b78da3436e
13 changed files with 375 additions and 46 deletions
+42 -2
View File
@@ -61,12 +61,54 @@
HardwareOptions hardwareOptions;
#if defined(LED_STRIP_GPIO)
extern const stm32_pulse_timer_t _led_timer;
#endif
#if !defined(BOOT)
#if defined(FUNCTION_SWITCHES)
#include "storage/storage.h"
#endif
#if defined(SIXPOS_SWITCH_INDEX)
uint8_t lastADCState = 0;
uint8_t sixPosState = 0;
bool dirty = true;
uint16_t getSixPosAnalogValue(uint16_t adcValue)
{
uint8_t currentADCState = 0;
if (adcValue > 3800)
currentADCState = 6;
else if (adcValue > 3100)
currentADCState = 5;
else if (adcValue > 2300)
currentADCState = 4;
else if (adcValue > 1500)
currentADCState = 3;
else if (adcValue > 1000)
currentADCState = 2;
else if (adcValue > 400)
currentADCState = 1;
if (lastADCState != currentADCState) {
lastADCState = currentADCState;
} else if (lastADCState != 0 && lastADCState - 1 != sixPosState) {
sixPosState = lastADCState - 1;
dirty = true;
}
if (dirty) {
for (uint8_t i = 0; i < 6; i++) {
if (i == sixPosState)
ws2812_set_color(i, SIXPOS_LED_RED, SIXPOS_LED_GREEN, SIXPOS_LED_BLUE);
else
ws2812_set_color(i, 0, 0, 0);
}
ws2812_update(&_led_timer);
}
return (4096/5)*(sixPosState);
}
#endif
void boardInit()
{
LL_APB1_GRP1_EnableClock(AUDIO_RCC_APB1Periph);
@@ -182,8 +224,6 @@ void boardInit()
usbInit();
#if defined(LED_STRIP_GPIO)
extern const stm32_pulse_timer_t _led_timer;
ws2812_init(&_led_timer, LED_STRIP_LENGTH, WS2812_GRB);
for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) {
ws2812_set_color(i, 0, 0, 50);