summaryrefslogtreecommitdiffstats
path: root/keyboards/ergodox/ez/keymaps
diff options
context:
space:
mode:
authordrashna <drashna@live.com>2017-08-12 01:58:25 -0700
committerJack Humbert <jack.humb@gmail.com>2017-08-14 16:20:24 -0400
commit0f2a7b621002a3f12247ae389e8f7c3b35e3ff0c (patch)
tree8d967ba741ecc86a74d5751880c3fd5f4c258d82 /keyboards/ergodox/ez/keymaps
parentcb7255755b84e2367f5cf0ec397262844b343817 (diff)
Fixed so will compile both with and without underglow
Diffstat (limited to 'keyboards/ergodox/ez/keymaps')
-rw-r--r--keyboards/ergodox/ez/keymaps/drashna/keymap.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/keyboards/ergodox/ez/keymaps/drashna/keymap.c b/keyboards/ergodox/ez/keymaps/drashna/keymap.c
index 343f6e0d87..a6e5b3335a 100644
--- a/keyboards/ergodox/ez/keymaps/drashna/keymap.c
+++ b/keyboards/ergodox/ez/keymaps/drashna/keymap.c
@@ -17,6 +17,8 @@
#define MOUS 2
#ifdef LAYER_UNDERGLOW_LIGHTING
+bool has_layer_changed = true;
+
#define rgblight_set_teal rgblight_setrgb(0x00, 0xFF, 0xFF)
#define rgblight_set_red rgblight_setrgb(0xFF, 0x00, 0x00)
#define rgblight_set_blue rgblight_setrgb(0x00, 0xFF, 0x00);
@@ -98,20 +100,12 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
-void matrix_init_user(void) { // Runs boot tasks for keyboard
-
-#ifdef LAYER_UNDERGLOW_LIGHTING
- rgblight_set_teal;
-#endif
-
-};
+
void matrix_scan_user(void) {
- static uint8_t old_layer = 0;
uint8_t new_layer = biton32(layer_state);
- uint8_t modifiders = get_mods();
ergodox_board_led_off();
ergodox_right_led_1_off();
@@ -119,6 +113,9 @@ void matrix_scan_user(void) {
ergodox_right_led_3_off();
#ifdef LAYER_UNDERGLOW_LIGHTING
+ static uint8_t old_layer = 0;
+ uint8_t modifiders = get_mods();
+
if ( modifiders & MODS_SHIFT_MASK) {
ergodox_right_led_1_on();
}
@@ -128,7 +125,12 @@ void matrix_scan_user(void) {
if ( modifiders & MODS_ALT_MASK) {
ergodox_right_led_3_on();
}
+
if (old_layer != new_layer) {
+ has_layer_changed = true;
+ old_layer = new_layer;
+ }
+ if (has_layer_changed) {
switch (new_layer) {
case 1:
rgblight_set_red;
@@ -155,9 +157,11 @@ void matrix_scan_user(void) {
rgblight_set_teal;
break;
}
- }
+ has_layer_changed = false;
+ }
+
#else
- switch (layer) {
+ switch (new_layer) {
case 1:
ergodox_right_led_1_on();
break;
@@ -188,5 +192,4 @@ void matrix_scan_user(void) {
break;
}
#endif
- old_layer = new_layer;
};