From 80c87054193b9243670aeb85adefbe1aa6c0fda0 Mon Sep 17 00:00:00 2001 From: Jack Humbert Date: Tue, 21 Jun 2016 12:53:21 -0400 Subject: [PATCH] reduces rgblight warnings, integrates completely (#428) --- keyboard/satan/led.c | 2 +- keyboard/satan/satan.h | 2 +- quantum/rgblight.c | 8 ++++---- quantum/rgblight.h | 1 - tmk_core/common/avr/eeconfig.c | 5 ++++- tmk_core/common/eeconfig.h | 1 + 6 files changed, 11 insertions(+), 8 deletions(-) diff --git a/keyboard/satan/led.c b/keyboard/satan/led.c index 5a9f2af672bb076183a6c48f3f13f34e08d74aa6..94606e89594dfcbe223d48f3d2b97ad346fcf88d 100644 --- a/keyboard/satan/led.c +++ b/keyboard/satan/led.c @@ -20,7 +20,7 @@ along with this program. If not, see . #include "led.h" -void led_init_ports() { +void led_init_ports(void) { // * Set our LED pins as output DDRB |= (1<<2); } diff --git a/keyboard/satan/satan.h b/keyboard/satan/satan.h index 12dec26a1ca662497aef9cd1b628e6dc5a04ac5c..464289fdbd2e2c20d8836407497c222e5f70e176 100644 --- a/keyboard/satan/satan.h +++ b/keyboard/satan/satan.h @@ -4,7 +4,7 @@ #include "matrix.h" #include "keymap.h" #include - +#include "action_util.h" /* Clueboard matrix layout * ,-----------------------------------------------------------. diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 8c9ad773645f827da1740d791dcd9dd997084be2..c29ffedc38ce3460f3730de7be7ffa4c30a296b6 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -42,7 +42,7 @@ void sethsv(uint16_t hue, uint8_t sat, uint8_t val, struct cRGB *led1) { The DIM_CURVE is used only on brightness/value and on saturation (inverted). This looks the most natural. */ - uint8_t r, g, b; + uint8_t r = 0, g = 0, b = 0; val = pgm_read_byte(&DIM_CURVE[val]); sat = 255 - pgm_read_byte(&DIM_CURVE[255 - sat]); @@ -154,7 +154,7 @@ void rgblight_init(void) { } void rgblight_increase(void) { - uint8_t mode; + uint8_t mode = 0; if (rgblight_config.mode < RGBLIGHT_MODES) { mode = rgblight_config.mode + 1; } @@ -162,7 +162,7 @@ void rgblight_increase(void) { } void rgblight_decrease(void) { - uint8_t mode; + uint8_t mode = 0; if (rgblight_config.mode > 1) { //mode will never < 1, if mode is less than 1, eeprom need to be initialized. mode = rgblight_config.mode-1; } @@ -170,7 +170,7 @@ void rgblight_decrease(void) { } void rgblight_step(void) { - uint8_t mode; + uint8_t mode = 0; mode = rgblight_config.mode + 1; if (mode > RGBLIGHT_MODES) { mode = 1; diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 37e207578ca000e2828dd45670682bdbe08979fd..64f92523e030d68b2dc8cdc6d7a9177814648646 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -64,7 +64,6 @@ void rgblight_decrease_val(void); void rgblight_sethsv(uint16_t hue, uint8_t sat, uint8_t val); void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b); -#define EECONFIG_RGBLIGHT (uint8_t *)7 uint32_t eeconfig_read_rgblight(void); void eeconfig_update_rgblight(uint32_t val); void eeconfig_update_rgblight_default(void); diff --git a/tmk_core/common/avr/eeconfig.c b/tmk_core/common/avr/eeconfig.c index c5391f5cf5af55332da299425d754320795022bc..656938fb333840c9b0132529ca7f9d709553f3ef 100644 --- a/tmk_core/common/avr/eeconfig.c +++ b/tmk_core/common/avr/eeconfig.c @@ -14,7 +14,10 @@ void eeconfig_init(void) eeprom_update_byte(EECONFIG_BACKLIGHT, 0); #endif #ifdef AUDIO_ENABLE - eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default + eeprom_update_byte(EECONFIG_AUDIO, 0xFF); // On by default +#endif +#ifdef RGBLIGHT_ENABLE + eeprom_update_dword(EECONFIG_RGBLIGHT, 0); #endif } diff --git a/tmk_core/common/eeconfig.h b/tmk_core/common/eeconfig.h index ca47e0d2fd91adb45a59a056cf8c0fec984c99f3..d8caa346f9d1a6ebe7c1fd164d5b12d3cfe701a9 100644 --- a/tmk_core/common/eeconfig.h +++ b/tmk_core/common/eeconfig.h @@ -32,6 +32,7 @@ along with this program. If not, see . #define EECONFIG_MOUSEKEY_ACCEL (uint8_t *)5 #define EECONFIG_BACKLIGHT (uint8_t *)6 #define EECONFIG_AUDIO (uint8_t *)7 +#define EECONFIG_RGBLIGHT (uint32_t *)8 /* debug bit */