summaryrefslogtreecommitdiff
path: root/keyboards/ergodox_ez/keymaps/drashna/keymap.c
diff options
context:
space:
mode:
authordrashna <drashna@live.com>2017-11-01 00:13:20 -0700
committerskullydazed <skullydazed@users.noreply.github.com>2017-11-01 00:13:20 -0700
commitb79a4cfeba32260a7d17c6e439ccd050416354f7 (patch)
tree91afc3fbf7708c9f5c83b56e99a1690278b7a827 /keyboards/ergodox_ez/keymaps/drashna/keymap.c
parent44d9ad95b7600fbcad75704dd4ffc163fc6c734d (diff)
Updated personal keymaps (#1945)
* Add woodpad * Cleanup * Remove misc layouts for woodpad * Move woodpad to handwired * Updated RGB Underglow info * Cleanup macros * Fix odd merge issue * Tweaked RGB lighting stuff * Start to merge orthodox/ergodox keymaps (persistant layers) * Add forced NKRO * Added Colemak and Dvorak layers to default orthodox keymap * Added default layer (qwerty/colemak/dvorak) detection to RGB Underglow * Updated macros and added workman keymaps * Fixed RGB lighting for Workman layout * Add leader keys * Remove force NKRO * Add Viterbi one handed layout and minor tweaks to others * Finishing up Viterbi keyboard layout, and NKRO tweaks to other layouts * Made "make" keystroke universal * Clean up and updates of drashna keymaps * Add workman layer to planck * Update to keymaps * Fix accidental commit because I don't know how to git * Fix makefile toggle code in ez keymap Finish adding RGB code to orthodox * missing underscore in init function declaration * Updated RGB Underglow layer indication code due to discovery of the layer_state_set_kb function * Remove unnecessary planck layout
Diffstat (limited to 'keyboards/ergodox_ez/keymaps/drashna/keymap.c')
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/keymap.c87
1 files changed, 43 insertions, 44 deletions
diff --git a/keyboards/ergodox_ez/keymaps/drashna/keymap.c b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
index cef0e9c39f..97ede94318 100644
--- a/keyboards/ergodox_ez/keymaps/drashna/keymap.c
+++ b/keyboards/ergodox_ez/keymaps/drashna/keymap.c
@@ -17,8 +17,6 @@
#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);
@@ -100,20 +98,23 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return true;
}
+void matrix_init_user(void) {
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ rgblight_enable();
+ rgblight_set_teal;
+ rgblight_mode(1);
+#endif
-
+}
void matrix_scan_user(void) {
- uint8_t new_layer = biton32(layer_state);
-
ergodox_board_led_off();
ergodox_right_led_1_off();
ergodox_right_led_2_off();
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) {
@@ -124,44 +125,10 @@ 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;
- break;
- case 2:
- rgblight_set_blue;
- break;
- case 3:
- rgblight_set_green;
- break;
- case 4:
- rgblight_set_yellow;
- break;
- case 5:
- rgblight_setrgb(0xFF, 0xFF, 0x00);
- break;
- case 6:
- rgblight_setrgb(0xFF, 0xFF, 0x00);
- break;
- case 7:
- rgblight_setrgb(0xFF, 0xFF, 0xFF);
- break;
- default:
- rgblight_set_teal;
- break;
- }
- has_layer_changed = false;
- }
-
-#else
- switch (new_layer) {
+ }
+#else
+ uint8_t layer = biton32(layer_state);
+ switch (layer) {
case 1:
ergodox_right_led_1_on();
break;
@@ -193,3 +160,35 @@ void matrix_scan_user(void) {
}
#endif
};
+
+uint32_t layer_state_set_kb(uint32_t state) {
+#ifdef LAYER_UNDERGLOW_LIGHTING
+ switch (biton32(state)) {
+ case 1:
+ rgblight_set_red;
+ break;
+ case 2:
+ rgblight_set_blue;
+ break;
+ case 3:
+ rgblight_set_green;
+ break;
+ case 4:
+ rgblight_set_yellow;
+ break;
+ case 5:
+ rgblight_setrgb(0xFF, 0xFF, 0x00);
+ break;
+ case 6:
+ rgblight_setrgb(0xFF, 0xFF, 0x00);
+ break;
+ case 7:
+ rgblight_setrgb(0xFF, 0xFF, 0xFF);
+ break;
+ default:
+ rgblight_set_teal;
+ break;
+ }
+#endif
+ return state;
+}