summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Diamond <josh@windowoffire.com>2022-07-30 18:31:31 -0400
committerGitHub <noreply@github.com>2022-07-30 18:31:31 -0400
commitbaf34989f1847185a055e9d41783052eccb09d9c (patch)
treef9f0a5f4cc4442a2ed33223a16e8d4cc8c4f9882
parentf02e3553808bb086b39946b63d5d4057060e02e7 (diff)
Default rgblight (#17855)
* better rgb bindings; improve default * trim firmware size
-rw-r--r--layouts/community/75_ansi/spidey3/keymap.c6
-rw-r--r--users/spidey3/config.h46
-rw-r--r--users/spidey3/init.c4
-rw-r--r--users/spidey3/layer_rgb.c18
-rw-r--r--users/spidey3/spidey3.h18
5 files changed, 49 insertions, 43 deletions
diff --git a/layouts/community/75_ansi/spidey3/keymap.c b/layouts/community/75_ansi/spidey3/keymap.c
index 05f3aac4bc..d500f11031 100644
--- a/layouts/community/75_ansi/spidey3/keymap.c
+++ b/layouts/community/75_ansi/spidey3/keymap.c
@@ -25,9 +25,9 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[_FN] = LAYOUT_75_ansi(
RESET, SPI_NORMAL, SPI_WIDE, SPI_SCRIPT, SPI_BLOCKS, SPI_CIRCLE, SPI_SQUARE, SPI_PARENS, SPI_FRAKTR, SPI_BOLD, SPI_MATH, XXXXXXX, SPI_GFLOCK, KC_SLEP, CH_SUSP, KC_PWR,
EEP_RST, X(SAD), X(MEH), X(HAPPY), X(ANGRY), X(THUMBDN), X(THUMBUP), X(SPIDER), X_BUL, X(LOL), X(SURPRISE),X_DASH, XXXXXXX, KC_PAUS, KC_SLCK,
- XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, RGB_SPD, RGB_SPI, VLK_TOG, XXXXXXX, XXXXXXX, KC_BRIU,
- XXXXXXX, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_T, SPI_LNX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRID,
- _______, SPI_GLO, XXXXXXX, SPI_WIN, UC_MOD, NK_TOGG, TG(_NUMPAD),SPI_OSX, X(LARR), X(RARR), DEBUG, _______, KC_VOLU, KC_MUTE,
+ XXXXXXX, RGB_TOG, RGB_MOD, RGB_HUD, RGB_HUI, RGB_SAD, RGB_SAI, RGB_VAD, RGB_VAI, SPI_GLO, VLK_TOG, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRIU,
+ XXXXXXX, RGB_M_P, RGB_M_B, RGB_M_R, RGB_M_SW, RGB_M_SN, RGB_M_K, RGB_M_G, RGB_M_TW, SPI_LNX, XXXXXXX, XXXXXXX, XXXXXXX, KC_BRID,
+ _______, XXXXXXX, XXXXXXX, SPI_WIN, UC_MOD, NK_TOGG, TG(_NUMPAD),SPI_OSX, X(LARR), X(RARR), DEBUG, _______, KC_VOLU, KC_MUTE,
_______, _______, _______, KC_MPLY, CH_ASST, _______, CH_CPNL, KC_MPRV, KC_VOLD, KC_MNXT
)
};
diff --git a/users/spidey3/config.h b/users/spidey3/config.h
index f5f5e07f0f..884cc11a5c 100644
--- a/users/spidey3/config.h
+++ b/users/spidey3/config.h
@@ -2,21 +2,37 @@
#define LED_DISABLE_WHEN_USB_SUSPENDED
#define RGB_DISABLE_WHEN_USB_SUSPENDED
-#define RGBLIGHT_LAYERS
-#define RGBLIGHT_MAX_LAYERS 17
-#define RGBLIGHT_LAYER_BLINK
-#define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
-#define RGBLIGHT_STARTUP_ANIMATION
-
-#undef RGBLIGHT_ANIMATIONS
-#define RGBLIGHT_EFFECT_BREATHING
-#define RGBLIGHT_EFFECT_RAINBOW_MOOD
-#define RGBLIGHT_EFFECT_RAINBOW_SWIRL
-#define RGBLIGHT_EFFECT_SNAKE
-#define RGBLIGHT_EFFECT_KNIGHT
-#define RGBLIGHT_EFFECT_STATIC_GRADIENT
-#define RGBLIGHT_EFFECT_ALTERNATING
-#define RGBLIGHT_EFFECT_TWINKLE
+
+#ifdef RGBLIGHT_ENABLE
+
+# define RGBLIGHT_LAYERS
+# define RGBLIGHT_MAX_LAYERS 17
+# define RGBLIGHT_LAYER_BLINK
+# define RGBLIGHT_LAYERS_OVERRIDE_RGB_OFF
+# define RGBLIGHT_STARTUP_ANIMATION
+
+# undef RGBLIGHT_ANIMATIONS
+# define RGBLIGHT_EFFECT_BREATHING
+# define RGBLIGHT_EFFECT_RAINBOW_MOOD
+# define RGBLIGHT_EFFECT_RAINBOW_SWIRL
+# define RGBLIGHT_EFFECT_SNAKE
+# define RGBLIGHT_EFFECT_KNIGHT
+# define RGBLIGHT_EFFECT_STATIC_GRADIENT
+# define RGBLIGHT_EFFECT_TWINKLE
+
+# define RGBLIGHT_DEFAULT_HUE 213
+# define RGBLIGHT_DEFAULT_SAT UINT8_MAX
+# define RGBLIGHT_DEFAULT_VAL RGBLIGHT_LIMIT_VAL / 2
+
+# if defined(RGBLIGHT_EFFECT_TWINKLE)
+# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_TWINKLE
+# elif defined(RGBLIGHT_EFFECT_RAINBOW_MOOD)
+# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_RAINBOW_MOOD
+# else
+# define RGBLIGHT_DEFAULT_MODE RGBLIGHT_MODE_STATIC_LIGHT
+# endif
+
+#endif
#define UNICODE_SELECTED_MODES UC_MAC, UC_LNX, UC_WINC
diff --git a/users/spidey3/init.c b/users/spidey3/init.c
index 0c2bd678e0..014dfdc3c4 100644
--- a/users/spidey3/init.c
+++ b/users/spidey3/init.c
@@ -11,10 +11,6 @@ void eeconfig_init_user(void) {
#ifdef UNICODEMAP_ENABLE
eeconfig_init_user_unicode();
#endif
-
-#ifdef RGBLIGHT_ENABLE
- eeconfig_init_user_rgb();
-#endif
}
#ifdef RGBLIGHT_ENABLE
diff --git a/users/spidey3/layer_rgb.c b/users/spidey3/layer_rgb.c
index 7381f64bb2..77558016d0 100644
--- a/users/spidey3/layer_rgb.c
+++ b/users/spidey3/layer_rgb.c
@@ -13,21 +13,15 @@ bool rgb_saved = 0;
extern bool spi_gflock;
extern uint16_t spi_replace_mode;
-void spidey_glow(void) {
+static void set_rgb_default(void) {
rgblight_enable();
- rgblight_sethsv(213, 255, 128);
- if ((RGBLIGHT_MODE_TWINKLE <= rgblight_get_mode()) && (rgblight_get_mode() < RGBLIGHT_MODE_TWINKLE_end)) {
- rgblight_step();
- } else {
- rgblight_mode(RGBLIGHT_MODE_TWINKLE);
- }
+ rgblight_sethsv(RGBLIGHT_DEFAULT_HUE, RGBLIGHT_DEFAULT_SAT, RGBLIGHT_DEFAULT_VAL);
+ rgblight_mode(RGBLIGHT_DEFAULT_MODE);
#ifdef VELOCIKEY_ENABLE
if (velocikey_enabled()) velocikey_toggle();
#endif
}
-void eeconfig_init_user_rgb(void) { spidey_glow(); }
-
// clang-format off
// Convenience macros
@@ -396,11 +390,9 @@ extern rgblight_config_t rgblight_config;
bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record) {
if (record->event.pressed) {
switch (keycode) {
- case SPI_GLO:
- spidey_glow();
- return false;
-
// clang-format off
+ case SPI_GLO: set_rgb_default(); return false;
+
case RGB_HUI: change_timer = timer_read(); change_hue = 1; return false;
case RGB_HUD: change_timer = timer_read(); change_hue = -1; return false;
case RGB_SAI: change_timer = timer_read(); change_sat = 1; return false;
diff --git a/users/spidey3/spidey3.h b/users/spidey3/spidey3.h
index 6fd26e224e..6d73c669bc 100644
--- a/users/spidey3/spidey3.h
+++ b/users/spidey3/spidey3.h
@@ -13,13 +13,12 @@ enum userspace_layers {
};
enum custom_keycodes {
- SPI_GLO = SAFE_RANGE,
- SPI_LNX, // Mode: Linux
- SPI_OSX, // Mode: Mac
- SPI_WIN, // Mode: Windows
- CH_CPNL, // AL Control Panel
- CH_ASST, // AL Context-aware Desktop Assistant
- CH_SUSP, // Suspend
+ SPI_LNX = SAFE_RANGE, // Mode: Linux
+ SPI_OSX, // Mode: Mac
+ SPI_WIN, // Mode: Windows
+ CH_CPNL, // AL Control Panel
+ CH_ASST, // AL Context-aware Desktop Assistant
+ CH_SUSP, // Suspend
SPI_NORMAL,
SPI_WIDE,
@@ -33,6 +32,10 @@ enum custom_keycodes {
SPI_MATH,
SPI_GFLOCK,
SPI_KP_00,
+
+#ifdef RGBLIGHT_ENABLE
+ SPI_GLO,
+#endif
};
#ifdef RGBLIGHT_ENABLE
@@ -52,7 +55,6 @@ typedef enum layer_ack {
# define RGB_LAYER_ACK_DURATION 500
-void eeconfig_init_user_rgb(void);
void matrix_init_user_rgb(void);
void matrix_scan_user_rgb(void);
void keyboard_post_init_user_rgb(void);