mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-22 07:45:29 +03:00
Moving config for Status Leds
This commit is contained in:
parent
bc547321cb
commit
0752a301b5
2 changed files with 33 additions and 30 deletions
|
@ -17,14 +17,47 @@
|
||||||
|
|
||||||
#include "platform.h"
|
#include "platform.h"
|
||||||
|
|
||||||
|
#include "config/parameter_group_ids.h"
|
||||||
|
|
||||||
#include "drivers/io.h"
|
#include "drivers/io.h"
|
||||||
#include "io_impl.h"
|
#include "io_impl.h"
|
||||||
|
|
||||||
#include "light_led.h"
|
#include "light_led.h"
|
||||||
|
|
||||||
|
PG_REGISTER_WITH_RESET_FN(statusLedConfig_t, statusLedConfig, PG_STATUS_LED_CONFIG, 0);
|
||||||
|
|
||||||
static IO_t leds[STATUS_LED_NUMBER];
|
static IO_t leds[STATUS_LED_NUMBER];
|
||||||
static uint8_t ledInversion = 0;
|
static uint8_t ledInversion = 0;
|
||||||
|
|
||||||
|
void pgResetFn_statusLedConfig(statusLedConfig_t *statusLedConfig)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < STATUS_LED_NUMBER; i++) {
|
||||||
|
statusLedConfig->ioTags[i] = IO_TAG_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef LED0_PIN
|
||||||
|
statusLedConfig->ioTags[0] = IO_TAG(LED0_PIN);
|
||||||
|
#endif
|
||||||
|
#ifdef LED1_PIN
|
||||||
|
statusLedConfig->ioTags[1] = IO_TAG(LED1_PIN);
|
||||||
|
#endif
|
||||||
|
#ifdef LED2_PIN
|
||||||
|
statusLedConfig->ioTags[2] = IO_TAG(LED2_PIN);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
statusLedConfig->inversion = 0
|
||||||
|
#ifdef LED0_INVERTED
|
||||||
|
| BIT(0)
|
||||||
|
#endif
|
||||||
|
#ifdef LED1_INVERTED
|
||||||
|
| BIT(1)
|
||||||
|
#endif
|
||||||
|
#ifdef LED2_INVERTED
|
||||||
|
| BIT(2)
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
void ledInit(const statusLedConfig_t *statusLedConfig)
|
void ledInit(const statusLedConfig_t *statusLedConfig)
|
||||||
{
|
{
|
||||||
ledInversion = statusLedConfig->inversion;
|
ledInversion = statusLedConfig->inversion;
|
||||||
|
|
|
@ -148,7 +148,6 @@ PG_REGISTER_WITH_RESET_FN(pwmConfig_t, pwmConfig, PG_PWM_CONFIG, 0);
|
||||||
#ifdef USE_PPM
|
#ifdef USE_PPM
|
||||||
PG_REGISTER_WITH_RESET_FN(ppmConfig_t, ppmConfig, PG_PPM_CONFIG, 0);
|
PG_REGISTER_WITH_RESET_FN(ppmConfig_t, ppmConfig, PG_PPM_CONFIG, 0);
|
||||||
#endif
|
#endif
|
||||||
PG_REGISTER_WITH_RESET_FN(statusLedConfig_t, statusLedConfig, PG_STATUS_LED_CONFIG, 0);
|
|
||||||
|
|
||||||
#ifdef USE_FLASHFS
|
#ifdef USE_FLASHFS
|
||||||
PG_REGISTER_WITH_RESET_TEMPLATE(flashConfig_t, flashConfig, PG_FLASH_CONFIG, 0);
|
PG_REGISTER_WITH_RESET_TEMPLATE(flashConfig_t, flashConfig, PG_FLASH_CONFIG, 0);
|
||||||
|
@ -255,35 +254,6 @@ void pgResetFn_pwmConfig(pwmConfig_t *pwmConfig)
|
||||||
#define SECOND_PORT_INDEX 1
|
#define SECOND_PORT_INDEX 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void pgResetFn_statusLedConfig(statusLedConfig_t *statusLedConfig)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < STATUS_LED_NUMBER; i++) {
|
|
||||||
statusLedConfig->ioTags[i] = IO_TAG_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef LED0_PIN
|
|
||||||
statusLedConfig->ioTags[0] = IO_TAG(LED0_PIN);
|
|
||||||
#endif
|
|
||||||
#ifdef LED1_PIN
|
|
||||||
statusLedConfig->ioTags[1] = IO_TAG(LED1_PIN);
|
|
||||||
#endif
|
|
||||||
#ifdef LED2_PIN
|
|
||||||
statusLedConfig->ioTags[2] = IO_TAG(LED2_PIN);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
statusLedConfig->inversion = 0
|
|
||||||
#ifdef LED0_INVERTED
|
|
||||||
| BIT(0)
|
|
||||||
#endif
|
|
||||||
#ifdef LED1_INVERTED
|
|
||||||
| BIT(1)
|
|
||||||
#endif
|
|
||||||
#ifdef LED2_INVERTED
|
|
||||||
| BIT(2)
|
|
||||||
#endif
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef USE_OSD_SLAVE
|
#ifndef USE_OSD_SLAVE
|
||||||
uint8_t getCurrentPidProfileIndex(void)
|
uint8_t getCurrentPidProfileIndex(void)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue