feat: support for RadioMaster GX12 (#5703)
Co-authored-by: raphaelcoeffic <1050031+raphaelcoeffic@users.noreply.github.com> Co-authored-by: philmoz <phil.a.mitchell@gmail.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
raphaelcoeffic
philmoz
Peter Feerick
parent
0f86cd9a95
commit
36cdd93a1a
@@ -21,8 +21,9 @@
|
||||
|
||||
#include "hal/gpio.h"
|
||||
#include "stm32_gpio.h"
|
||||
|
||||
#include "boards/generic_stm32/rgb_leds.h"
|
||||
#include "board.h"
|
||||
#include "colors.h"
|
||||
|
||||
void ledInit()
|
||||
{
|
||||
@@ -39,7 +40,7 @@ void ledInit()
|
||||
gpio_init(LED_BLUE_GPIO, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
#endif
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
#if defined(FUNCTION_SWITCHES) && !defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||
gpio_init(FSLED_GPIO_1, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
gpio_init(FSLED_GPIO_2, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
gpio_init(FSLED_GPIO_3, GPIO_OUT, GPIO_PIN_SPEED_LOW);
|
||||
@@ -50,7 +51,23 @@ void ledInit()
|
||||
|
||||
}
|
||||
|
||||
#if defined(FUNCTION_SWITCHES)
|
||||
#if defined(FUNCTION_SWITCHES_RGB_LEDS)
|
||||
// used to map switch number to led number in the rgbled chain
|
||||
uint8_t ledMapping[] = {1, 2, 3, 4, 5, 6};
|
||||
|
||||
void fsLedOff(uint8_t index, uint32_t color)
|
||||
{
|
||||
rgbSetLedColor(ledMapping[index], GET_RED(color), \
|
||||
GET_GREEN(color),GET_BLUE(color));
|
||||
}
|
||||
|
||||
void fsLedOn(uint8_t index, uint32_t color)
|
||||
{
|
||||
rgbSetLedColor(ledMapping[index], GET_RED(color), \
|
||||
GET_GREEN(color),GET_BLUE(color));
|
||||
}
|
||||
|
||||
#elif defined(FUNCTION_SWITCHES)
|
||||
gpio_t fsLeds[] = {FSLED_GPIO_1, FSLED_GPIO_2,
|
||||
FSLED_GPIO_3, FSLED_GPIO_4,
|
||||
FSLED_GPIO_5, FSLED_GPIO_6};
|
||||
@@ -65,7 +82,7 @@ void fsLedOn(uint8_t index)
|
||||
gpio_set(fsLeds[index]);
|
||||
}
|
||||
|
||||
bool getFSLedState(uint8_t index)
|
||||
bool fsLedState(uint8_t index)
|
||||
{
|
||||
return (gpio_read(fsLeds[index]));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user