From 0752a301b5156f4a44930a7817efed2db26af5d1 Mon Sep 17 00:00:00 2001 From: blckmn Date: Sat, 17 Jun 2017 19:20:10 +1000 Subject: [PATCH] Moving config for Status Leds --- src/main/drivers/light_led.c | 33 +++++++++++++++++++++++++++++++++ src/main/fc/config.c | 30 ------------------------------ 2 files changed, 33 insertions(+), 30 deletions(-) diff --git a/src/main/drivers/light_led.c b/src/main/drivers/light_led.c index 235e7e451..154f0231f 100644 --- a/src/main/drivers/light_led.c +++ b/src/main/drivers/light_led.c @@ -17,14 +17,47 @@ #include "platform.h" +#include "config/parameter_group_ids.h" + #include "drivers/io.h" #include "io_impl.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 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) { ledInversion = statusLedConfig->inversion; diff --git a/src/main/fc/config.c b/src/main/fc/config.c index 2077c0942..207d096ca 100755 --- a/src/main/fc/config.c +++ b/src/main/fc/config.c @@ -148,7 +148,6 @@ PG_REGISTER_WITH_RESET_FN(pwmConfig_t, pwmConfig, PG_PWM_CONFIG, 0); #ifdef USE_PPM PG_REGISTER_WITH_RESET_FN(ppmConfig_t, ppmConfig, PG_PPM_CONFIG, 0); #endif -PG_REGISTER_WITH_RESET_FN(statusLedConfig_t, statusLedConfig, PG_STATUS_LED_CONFIG, 0); #ifdef USE_FLASHFS 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 #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 uint8_t getCurrentPidProfileIndex(void) {