summaryrefslogtreecommitdiffstats
path: root/keyboards/ergodox_ez/keymaps/default/keymap.c
diff options
context:
space:
mode:
authorJack Humbert <jack.humb@gmail.com>2017-11-06 08:38:36 -0500
committerJack Humbert <jack.humb@gmail.com>2017-11-06 08:38:36 -0500
commitcf9f6bbd917c56e7347993f9116953628b16bc6a (patch)
tree0eebf47fa40eb871b45b1a84514714c5e8243940 /keyboards/ergodox_ez/keymaps/default/keymap.c
parent41df0dc9a75dd9ffc3f0026eb673337d2aa0c5c6 (diff)
adds per-layer rgb color option to ez
Diffstat (limited to 'keyboards/ergodox_ez/keymaps/default/keymap.c')
-rw-r--r--keyboards/ergodox_ez/keymaps/default/keymap.c42
1 files changed, 34 insertions, 8 deletions
diff --git a/keyboards/ergodox_ez/keymaps/default/keymap.c b/keyboards/ergodox_ez/keymaps/default/keymap.c
index 4f0136880e..ccb4ae3ada 100644
--- a/keyboards/ergodox_ez/keymaps/default/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/default/keymap.c
@@ -197,27 +197,53 @@ void matrix_init_user(void) {
};
-
// Runs constantly in the background, in a loop.
void matrix_scan_user(void) {
- uint8_t layer = biton32(layer_state);
+};
+// Runs whenever there is a layer state change.
+uint32_t layer_state_set_user(uint32_t state) {
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
ergodox_right_led_3_off();
+
+ uint8_t layer = biton32(state);
switch (layer) {
- // TODO: Make this relevant to the ErgoDox EZ.
- case SYMB:
+ case 0:
+ #ifdef RGBLIGHT_COLOR_LAYER_0
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_0);
+ #endif
+ break;
+ case 1:
ergodox_right_led_1_on();
+ #ifdef RGBLIGHT_COLOR_LAYER_1
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_1);
+ #endif
break;
- case MDIA:
+ case 2:
ergodox_right_led_2_on();
+ #ifdef RGBLIGHT_COLOR_LAYER_2
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_2);
+ #endif
+ break;
+ case 3:
+ #ifdef RGBLIGHT_COLOR_LAYER_3
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_3);
+ #endif
break;
- default:
- // none
+ case 4:
+ #ifdef RGBLIGHT_COLOR_LAYER_4
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_4);
+ #endif
+ break;
+ case 5:
+ #ifdef RGBLIGHT_COLOR_LAYER_5
+ rgblight_setrgb(RGBLIGHT_COLOR_LAYER_5);
+ #endif
break;
}
-};
+ return state;
+}; \ No newline at end of file