feat: support for HelloRadioSky V16 (#5317)
Co-authored-by: Peter Feerick <pfeerick@users.noreply.github.com>
This commit is contained in:
co-authored by
Peter Feerick
parent
4426f56cb9
commit
17bf9dc813
@@ -22,6 +22,7 @@
|
||||
#include "stm32_hal.h"
|
||||
#include "stm32_hal_ll.h"
|
||||
#include "stm32_gpio.h"
|
||||
#include "stm32_ws2812.h"
|
||||
|
||||
#include "hal/adc_driver.h"
|
||||
#include "hal/trainer_driver.h"
|
||||
@@ -34,6 +35,7 @@
|
||||
#include "boards/generic_stm32/module_ports.h"
|
||||
#include "boards/generic_stm32/intmodule_heartbeat.h"
|
||||
#include "boards/generic_stm32/analog_inputs.h"
|
||||
#include "boards/generic_stm32/rgb_leds.h"
|
||||
|
||||
#include "timers_driver.h"
|
||||
#include "dataconstants.h"
|
||||
@@ -48,6 +50,23 @@
|
||||
#include "flysky_gimbal_driver.h"
|
||||
#endif
|
||||
|
||||
#if defined(CSD203_SENSOR)
|
||||
#include "csd203_sensor.h"
|
||||
#endif
|
||||
|
||||
#if defined(LED_STRIP_GPIO)
|
||||
// Common LED driver
|
||||
extern const stm32_pulse_timer_t _led_timer;
|
||||
|
||||
void ledStripOff()
|
||||
{
|
||||
for (uint8_t i = 0; i < LED_STRIP_LENGTH; i++) {
|
||||
ws2812_set_color(i, 0, 0, 0);
|
||||
}
|
||||
ws2812_update(&_led_timer);
|
||||
}
|
||||
#endif
|
||||
|
||||
HardwareOptions hardwareOptions;
|
||||
bool boardBacklightOn = false;
|
||||
|
||||
@@ -63,6 +82,44 @@ void boardBLInit()
|
||||
#if !defined(BOOT)
|
||||
#include "edgetx.h"
|
||||
|
||||
#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()
|
||||
{
|
||||
#if defined(RADIO_FAMILY_T16)
|
||||
@@ -163,9 +220,22 @@ void boardInit()
|
||||
|
||||
timersInit();
|
||||
|
||||
#if defined(HARDWARE_TOUCH) && !defined(SIMU)
|
||||
touchPanelInit();
|
||||
#endif
|
||||
|
||||
#if defined(CSD203_SENSOR)
|
||||
initCSD203();
|
||||
#endif
|
||||
|
||||
usbInit();
|
||||
hapticInit();
|
||||
|
||||
#if defined(LED_STRIP_GPIO)
|
||||
ws2812_init(&_led_timer, LED_STRIP_LENGTH, WS2812_GRB);
|
||||
ledStripOff();
|
||||
#endif
|
||||
|
||||
#if defined(BLUETOOTH)
|
||||
bluetoothInit(BLUETOOTH_DEFAULT_BAUDRATE, true);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user