From a7113c8ed090d0ac647f30ee9b8ef41252e568ed Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 30 Apr 2019 00:18:50 +0200 Subject: Updated rgb_led struct field modifier to flags (#5619) Updated effects to test led flags Updated massdrop to use new flags field for led toggle --- keyboards/massdrop/alt/keymaps/abishalom/keymap.c | 26 +++++++++++++++++++++++ keyboards/massdrop/alt/keymaps/default/keymap.c | 26 +++++++++++++++++++++++ keyboards/massdrop/alt/keymaps/mac/keymap.c | 26 +++++++++++++++++++++++ 3 files changed, 78 insertions(+) (limited to 'keyboards/massdrop/alt/keymaps') diff --git a/keyboards/massdrop/alt/keymaps/abishalom/keymap.c b/keyboards/massdrop/alt/keymaps/abishalom/keymap.c index a4519d4049..f6f79ad91e 100644 --- a/keyboards/massdrop/alt/keymaps/abishalom/keymap.c +++ b/keyboards/massdrop/alt/keymaps/abishalom/keymap.c @@ -95,6 +95,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_KEYLIGHT: { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_UNDERGLOW: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_disable_noeeprom(); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } + } + return false; default: return true; //Process all other keycodes normally } diff --git a/keyboards/massdrop/alt/keymaps/default/keymap.c b/keyboards/massdrop/alt/keymaps/default/keymap.c index a4519d4049..f6f79ad91e 100644 --- a/keyboards/massdrop/alt/keymaps/default/keymap.c +++ b/keyboards/massdrop/alt/keymaps/default/keymap.c @@ -95,6 +95,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_KEYLIGHT: { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_UNDERGLOW: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_disable_noeeprom(); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } + } + return false; default: return true; //Process all other keycodes normally } diff --git a/keyboards/massdrop/alt/keymaps/mac/keymap.c b/keyboards/massdrop/alt/keymaps/mac/keymap.c index 26a1c6d014..222d7e2c50 100644 --- a/keyboards/massdrop/alt/keymaps/mac/keymap.c +++ b/keyboards/massdrop/alt/keymaps/mac/keymap.c @@ -95,6 +95,32 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { } } return false; + case RGB_TOG: + if (record->event.pressed) { + switch (rgb_matrix_get_flags()) { + case LED_FLAG_ALL: { + rgb_matrix_set_flags(LED_FLAG_KEYLIGHT); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_KEYLIGHT: { + rgb_matrix_set_flags(LED_FLAG_UNDERGLOW); + rgb_matrix_set_color_all(0, 0, 0); + } + break; + case LED_FLAG_UNDERGLOW: { + rgb_matrix_set_flags(LED_FLAG_NONE); + rgb_matrix_disable_noeeprom(); + } + break; + default: { + rgb_matrix_set_flags(LED_FLAG_ALL); + rgb_matrix_enable_noeeprom(); + } + break; + } + } + return false; default: return true; //Process all other keycodes normally } -- cgit v1.2.3