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/config.h | 1 - keyboards/massdrop/alt/config_led.c | 210 +++++++++++----------- keyboards/massdrop/alt/keymaps/abishalom/keymap.c | 26 +++ keyboards/massdrop/alt/keymaps/default/keymap.c | 26 +++ keyboards/massdrop/alt/keymaps/mac/keymap.c | 26 +++ 5 files changed, 183 insertions(+), 106 deletions(-) (limited to 'keyboards/massdrop/alt') diff --git a/keyboards/massdrop/alt/config.h b/keyboards/massdrop/alt/config.h index f63c38bf6..59e66e133 100644 --- a/keyboards/massdrop/alt/config.h +++ b/keyboards/massdrop/alt/config.h @@ -123,6 +123,5 @@ along with this program. If not, see . #define RGB_MATRIX_KEYPRESSES #define RGB_MATRIX_LED_PROCESS_LIMIT 15 #define RGB_MATRIX_LED_FLUSH_LIMIT 10 -#define RGB_MATRIX_EXTRA_TOG #include "config_led.h" diff --git a/keyboards/massdrop/alt/config_led.c b/keyboards/massdrop/alt/config_led.c index 7d98e47c9..1a9a539a0 100644 --- a/keyboards/massdrop/alt/config_led.c +++ b/keyboards/massdrop/alt/config_led.c @@ -20,122 +20,122 @@ // // There is a quick-and-dirty implementation of this under ledvis.html -const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - /* 0 */ { { (0)|(0 << 4) }, { 8, 56 }, 0 }, // KC_ESC - /* 1 */ { { (0)|(1 << 4) }, { 22, 56 }, 0 }, // KC_1 - /* 2 */ { { (0)|(2 << 4) }, { 35, 56 }, 0 }, // KC_2 - /* 3 */ { { (0)|(3 << 4) }, { 49, 56 }, 0 }, // KC_3 - /* 4 */ { { (0)|(4 << 4) }, { 63, 56 }, 0 }, // KC_4 - /* 5 */ { { (0)|(5 << 4) }, { 77, 56 }, 0 }, // KC_5 - /* 6 */ { { (0)|(6 << 4) }, { 91, 56 }, 0 }, // KC_6 - /* 7 */ { { (0)|(7 << 4) }, { 105, 56 }, 0 }, // KC_7 - /* 8 */ { { (0)|(8 << 4) }, { 118, 56 }, 0 }, // KC_8 - /* 9 */ { { (0)|(9 << 4) }, { 132, 56 }, 0 }, // KC_9 - /* 10 */ { { (0)|(10 << 4) }, { 146, 56 }, 0 }, // KC_0 - /* 11 */ { { (0)|(11 << 4) }, { 160, 56 }, 0 }, // KC_MINS - /* 12 */ { { (0)|(12 << 4) }, { 174, 56 }, 0 }, // KC_EQL - /* 13 */ { { (0)|(13 << 4) }, { 195, 56 }, 0 }, // KC_BSPC - /* 14 */ { { (0)|(14 << 4) }, { 215, 56 }, 0 }, // KC_DEL - /* 15 */ { { (1)|(0 << 4) }, { 11, 44 }, 0 }, // KC_TAB - /* 16 */ { { (1)|(1 << 4) }, { 28, 44 }, 0 }, // KC_Q - /* 17 */ { { (1)|(2 << 4) }, { 42, 44 }, 0 }, // KC_W - /* 18 */ { { (1)|(3 << 4) }, { 56, 44 }, 0 }, // KC_E - /* 19 */ { { (1)|(4 << 4) }, { 70, 44 }, 0 }, // KC_R - /* 20 */ { { (1)|(5 << 4) }, { 84, 44 }, 0 }, // KC_T - /* 21 */ { { (1)|(6 << 4) }, { 98, 44 }, 0 }, // KC_Y - /* 22 */ { { (1)|(7 << 4) }, { 112, 44 }, 0 }, // KC_U - /* 23 */ { { (1)|(8 << 4) }, { 125, 44 }, 0 }, // KC_I - /* 24 */ { { (1)|(9 << 4) }, { 139, 44 }, 0 }, // KC_O - /* 25 */ { { (1)|(10 << 4) }, { 153, 44 }, 0 }, // KC_P - /* 26 */ { { (1)|(11 << 4) }, { 167, 44 }, 0 }, // KC_LBRC - /* 27 */ { { (1)|(12 << 4) }, { 181, 44 }, 0 }, // KC_RBRC - /* 28 */ { { (1)|(13 << 4) }, { 198, 44 }, 0 }, // KC_BSLS - /* 29 */ { { (1)|(14 << 4) }, { 215, 44 }, 0 }, // KC_HOME +rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { + /* 0 */ { { (0)|(0 << 4) }, { 8, 56 }, 4 }, // KC_ESC + /* 1 */ { { (0)|(1 << 4) }, { 22, 56 }, 4 }, // KC_1 + /* 2 */ { { (0)|(2 << 4) }, { 35, 56 }, 4 }, // KC_2 + /* 3 */ { { (0)|(3 << 4) }, { 49, 56 }, 4 }, // KC_3 + /* 4 */ { { (0)|(4 << 4) }, { 63, 56 }, 4 }, // KC_4 + /* 5 */ { { (0)|(5 << 4) }, { 77, 56 }, 4 }, // KC_5 + /* 6 */ { { (0)|(6 << 4) }, { 91, 56 }, 4 }, // KC_6 + /* 7 */ { { (0)|(7 << 4) }, { 105, 56 }, 4 }, // KC_7 + /* 8 */ { { (0)|(8 << 4) }, { 118, 56 }, 4 }, // KC_8 + /* 9 */ { { (0)|(9 << 4) }, { 132, 56 }, 4 }, // KC_9 + /* 10 */ { { (0)|(10 << 4) }, { 146, 56 }, 4 }, // KC_0 + /* 11 */ { { (0)|(11 << 4) }, { 160, 56 }, 4 }, // KC_MINS + /* 12 */ { { (0)|(12 << 4) }, { 174, 56 }, 4 }, // KC_EQL + /* 13 */ { { (0)|(13 << 4) }, { 195, 56 }, 4 }, // KC_BSPC + /* 14 */ { { (0)|(14 << 4) }, { 215, 56 }, 4 }, // KC_DEL + /* 15 */ { { (1)|(0 << 4) }, { 11, 44 }, 4 }, // KC_TAB + /* 16 */ { { (1)|(1 << 4) }, { 28, 44 }, 4 }, // KC_Q + /* 17 */ { { (1)|(2 << 4) }, { 42, 44 }, 4 }, // KC_W + /* 18 */ { { (1)|(3 << 4) }, { 56, 44 }, 4 }, // KC_E + /* 19 */ { { (1)|(4 << 4) }, { 70, 44 }, 4 }, // KC_R + /* 20 */ { { (1)|(5 << 4) }, { 84, 44 }, 4 }, // KC_T + /* 21 */ { { (1)|(6 << 4) }, { 98, 44 }, 4 }, // KC_Y + /* 22 */ { { (1)|(7 << 4) }, { 112, 44 }, 4 }, // KC_U + /* 23 */ { { (1)|(8 << 4) }, { 125, 44 }, 4 }, // KC_I + /* 24 */ { { (1)|(9 << 4) }, { 139, 44 }, 4 }, // KC_O + /* 25 */ { { (1)|(10 << 4) }, { 153, 44 }, 4 }, // KC_P + /* 26 */ { { (1)|(11 << 4) }, { 167, 44 }, 4 }, // KC_LBRC + /* 27 */ { { (1)|(12 << 4) }, { 181, 44 }, 4 }, // KC_RBRC + /* 28 */ { { (1)|(13 << 4) }, { 198, 44 }, 4 }, // KC_BSLS + /* 29 */ { { (1)|(14 << 4) }, { 215, 44 }, 4 }, // KC_HOME /* 30 */ { { (2)|(0 << 4) }, { 13, 32 }, 1 }, // KC_CAPS - /* 31 */ { { (2)|(1 << 4) }, { 32, 32 }, 0 }, // KC_A - /* 32 */ { { (2)|(2 << 4) }, { 46, 32 }, 0 }, // KC_S - /* 33 */ { { (2)|(3 << 4) }, { 60, 32 }, 0 }, // KC_D - /* 34 */ { { (2)|(4 << 4) }, { 73, 32 }, 0 }, // KC_F - /* 35 */ { { (2)|(5 << 4) }, { 87, 32 }, 0 }, // KC_G - /* 36 */ { { (2)|(6 << 4) }, { 101, 32 }, 0 }, // KC_H - /* 37 */ { { (2)|(7 << 4) }, { 115, 32 }, 0 }, // KC_J - /* 38 */ { { (2)|(8 << 4) }, { 129, 32 }, 0 }, // KC_K - /* 39 */ { { (2)|(9 << 4) }, { 143, 32 }, 0 }, // KC_L - /* 40 */ { { (2)|(10 << 4) }, { 156, 32 }, 0 }, // KC_SCLN - /* 41 */ { { (2)|(11 << 4) }, { 170, 32 }, 0 }, // KC_QUOT + /* 31 */ { { (2)|(1 << 4) }, { 32, 32 }, 4 }, // KC_A + /* 32 */ { { (2)|(2 << 4) }, { 46, 32 }, 4 }, // KC_S + /* 33 */ { { (2)|(3 << 4) }, { 60, 32 }, 4 }, // KC_D + /* 34 */ { { (2)|(4 << 4) }, { 73, 32 }, 4 }, // KC_F + /* 35 */ { { (2)|(5 << 4) }, { 87, 32 }, 4 }, // KC_G + /* 36 */ { { (2)|(6 << 4) }, { 101, 32 }, 4 }, // KC_H + /* 37 */ { { (2)|(7 << 4) }, { 115, 32 }, 4 }, // KC_J + /* 38 */ { { (2)|(8 << 4) }, { 129, 32 }, 4 }, // KC_K + /* 39 */ { { (2)|(9 << 4) }, { 143, 32 }, 4 }, // KC_L + /* 40 */ { { (2)|(10 << 4) }, { 156, 32 }, 4 }, // KC_SCLN + /* 41 */ { { (2)|(11 << 4) }, { 170, 32 }, 4 }, // KC_QUOT /* _________________________________________ */ // ____ - /* 42 */ { { (2)|(13 << 4) }, { 193, 32 }, 0 }, // KC_ENT - /* 43 */ { { (2)|(14 << 4) }, { 215, 32 }, 0 }, // KC_PGUP - /* 44 */ { { (3)|(0 << 4) }, { 16, 19 }, 0 }, // KC_LSFT - /* 45 */ { { (3)|(2 << 4) }, { 39, 19 }, 0 }, // KC_Z - /* 46 */ { { (3)|(3 << 4) }, { 53, 19 }, 0 }, // KC_X - /* 47 */ { { (3)|(4 << 4) }, { 67, 19 }, 0 }, // KC_C - /* 48 */ { { (3)|(5 << 4) }, { 80, 19 }, 0 }, // KC_V - /* 49 */ { { (3)|(6 << 4) }, { 94, 19 }, 0 }, // KC_B - /* 50 */ { { (3)|(7 << 4) }, { 108, 19 }, 0 }, // KC_N - /* 51 */ { { (3)|(8 << 4) }, { 122, 19 }, 0 }, // KC_M - /* 52 */ { { (3)|(9 << 4) }, { 136, 19 }, 0 }, // KC_COMM - /* 53 */ { { (3)|(10 << 4) }, { 150, 19 }, 0 }, // KC_DOT - /* 54 */ { { (3)|(11 << 4) }, { 163, 19 }, 0 }, // KC_SLSH - /* 55 */ { { (3)|(12 << 4) }, { 182, 19 }, 0 }, // KC_RSFT + /* 42 */ { { (2)|(13 << 4) }, { 193, 32 }, 4 }, // KC_ENT + /* 43 */ { { (2)|(14 << 4) }, { 215, 32 }, 4 }, // KC_PGUP + /* 44 */ { { (3)|(0 << 4) }, { 16, 19 }, 4 }, // KC_LSFT + /* 45 */ { { (3)|(2 << 4) }, { 39, 19 }, 4 }, // KC_Z + /* 46 */ { { (3)|(3 << 4) }, { 53, 19 }, 4 }, // KC_X + /* 47 */ { { (3)|(4 << 4) }, { 67, 19 }, 4 }, // KC_C + /* 48 */ { { (3)|(5 << 4) }, { 80, 19 }, 4 }, // KC_V + /* 49 */ { { (3)|(6 << 4) }, { 94, 19 }, 4 }, // KC_B + /* 50 */ { { (3)|(7 << 4) }, { 108, 19 }, 4 }, // KC_N + /* 51 */ { { (3)|(8 << 4) }, { 122, 19 }, 4 }, // KC_M + /* 52 */ { { (3)|(9 << 4) }, { 136, 19 }, 4 }, // KC_COMM + /* 53 */ { { (3)|(10 << 4) }, { 150, 19 }, 4 }, // KC_DOT + /* 54 */ { { (3)|(11 << 4) }, { 163, 19 }, 4 }, // KC_SLSH + /* 55 */ { { (3)|(12 << 4) }, { 182, 19 }, 4 }, // KC_RSFT /* _________________________________________ */ // ____ - /* 56 */ { { (3)|(13 << 4) }, { 201, 19 }, 0 }, // KC_UP - /* 57 */ { { (3)|(14 << 4) }, { 215, 19 }, 0 }, // KC_PGDN - /* 58 */ { { (4)|(0 << 4) }, { 9, 7 }, 0 }, // KC_LCTL - /* 59 */ { { (4)|(1 << 4) }, { 27, 7 }, 0 }, // KC_LGUI - /* 60 */ { { (4)|(2 << 4) }, { 44, 7 }, 0 }, // KC_LALT + /* 56 */ { { (3)|(13 << 4) }, { 201, 19 }, 4 }, // KC_UP + /* 57 */ { { (3)|(14 << 4) }, { 215, 19 }, 4 }, // KC_PGDN + /* 58 */ { { (4)|(0 << 4) }, { 9, 7 }, 4 }, // KC_LCTL + /* 59 */ { { (4)|(1 << 4) }, { 27, 7 }, 4 }, // KC_LGUI + /* 60 */ { { (4)|(2 << 4) }, { 44, 7 }, 4 }, // KC_LALT /* _________________________________________ */ // ____ /* _________________________________________ */ // ____ /* _________________________________________ */ // ____ - /* 61 */ { { (4)|(6 << 4) }, { 96, 7 }, 0 }, // KC_SPC + /* 61 */ { { (4)|(6 << 4) }, { 96, 7 }, 4 }, // KC_SPC /* _________________________________________ */ // ____ /* _________________________________________ */ // ____ /* _________________________________________ */ // ____ - /* 62 */ { { (4)|(10 << 4) }, { 148, 7 }, 0 }, // KC_RALT - /* 63 */ { { (4)|(11 << 4) }, { 165, 7 }, 0 }, // MO(1) - /* 64 */ { { (4)|(12 << 4) }, { 188, 7 }, 0 }, // KC_LEFT - /* 65 */ { { (4)|(13 << 4) }, { 201, 7 }, 0 }, // KC_DOWN - /* 66 */ { { (4)|(14 << 4) }, { 215, 7 }, 0 }, // KC_RGHT + /* 62 */ { { (4)|(10 << 4) }, { 148, 7 }, 4 }, // KC_RALT + /* 63 */ { { (4)|(11 << 4) }, { 165, 7 }, 4 }, // MO(1) + /* 64 */ { { (4)|(12 << 4) }, { 188, 7 }, 4 }, // KC_LEFT + /* 65 */ { { (4)|(13 << 4) }, { 201, 7 }, 4 }, // KC_DOWN + /* 66 */ { { (4)|(14 << 4) }, { 215, 7 }, 4 }, // KC_RGHT // Underglow LEDs - { { 255 }, { 1, 1 }, 0 }, - { { 255 }, { 15, 0 }, 0 }, - { { 255 }, { 31, 0 }, 0 }, - { { 255 }, { 47, 0 }, 0 }, - { { 255 }, { 63, 0 }, 0 }, - { { 255 }, { 79, 0 }, 0 }, - { { 255 }, { 95, 0 }, 0 }, - { { 255 }, { 112, 0 }, 0 }, - { { 255 }, { 128, 0 }, 0 }, - { { 255 }, { 144, 0 }, 0 }, - { { 255 }, { 160, 0 }, 0 }, - { { 255 }, { 176, 0 }, 0 }, - { { 255 }, { 192, 0 }, 0 }, - { { 255 }, { 208, 0 }, 0 }, - { { 255 }, { 222, 1 }, 0 }, - { { 255 }, { 224, 13 }, 0 }, - { { 255 }, { 224, 25 }, 0 }, - { { 255 }, { 224, 38 }, 0 }, - { { 255 }, { 224, 50 }, 0 }, - { { 255 }, { 222, 62 }, 0 }, - { { 255 }, { 191, 64 }, 0 }, - { { 255 }, { 179, 64 }, 0 }, - { { 255 }, { 167, 64 }, 0 }, - { { 255 }, { 153, 64 }, 0 }, - { { 255 }, { 139, 64 }, 0 }, - { { 255 }, { 125, 64 }, 0 }, - { { 255 }, { 112, 64 }, 0 }, - { { 255 }, { 98, 64 }, 0 }, - { { 255 }, { 84, 64 }, 0 }, - { { 255 }, { 70, 64 }, 0 }, - { { 255 }, { 56, 64 }, 0 }, - { { 255 }, { 42, 64 }, 0 }, - { { 255 }, { 28, 64 }, 0 }, - { { 255 }, { 1, 62 }, 0 }, - { { 255 }, { 0, 50 }, 0 }, - { { 255 }, { 0, 38 }, 0 }, - { { 255 }, { 0, 25 }, 0 }, - { { 255 }, { 0, 13 }, 0 }, + { { 255 }, { 1, 1 }, 2 }, + { { 255 }, { 15, 0 }, 2 }, + { { 255 }, { 31, 0 }, 2 }, + { { 255 }, { 47, 0 }, 2 }, + { { 255 }, { 63, 0 }, 2 }, + { { 255 }, { 79, 0 }, 2 }, + { { 255 }, { 95, 0 }, 2 }, + { { 255 }, { 112, 0 }, 2 }, + { { 255 }, { 128, 0 }, 2 }, + { { 255 }, { 144, 0 }, 2 }, + { { 255 }, { 160, 0 }, 2 }, + { { 255 }, { 176, 0 }, 2 }, + { { 255 }, { 192, 0 }, 2 }, + { { 255 }, { 208, 0 }, 2 }, + { { 255 }, { 222, 1 }, 2 }, + { { 255 }, { 224, 13 }, 2 }, + { { 255 }, { 224, 25 }, 2 }, + { { 255 }, { 224, 38 }, 2 }, + { { 255 }, { 224, 50 }, 2 }, + { { 255 }, { 222, 62 }, 2 }, + { { 255 }, { 191, 64 }, 2 }, + { { 255 }, { 179, 64 }, 2 }, + { { 255 }, { 167, 64 }, 2 }, + { { 255 }, { 153, 64 }, 2 }, + { { 255 }, { 139, 64 }, 2 }, + { { 255 }, { 125, 64 }, 2 }, + { { 255 }, { 112, 64 }, 2 }, + { { 255 }, { 98, 64 }, 2 }, + { { 255 }, { 84, 64 }, 2 }, + { { 255 }, { 70, 64 }, 2 }, + { { 255 }, { 56, 64 }, 2 }, + { { 255 }, { 42, 64 }, 2 }, + { { 255 }, { 28, 64 }, 2 }, + { { 255 }, { 1, 62 }, 2 }, + { { 255 }, { 0, 50 }, 2 }, + { { 255 }, { 0, 38 }, 2 }, + { { 255 }, { 0, 25 }, 2 }, + { { 255 }, { 0, 13 }, 2 }, }; #ifdef USB_LED_INDICATOR_ENABLE diff --git a/keyboards/massdrop/alt/keymaps/abishalom/keymap.c b/keyboards/massdrop/alt/keymaps/abishalom/keymap.c index a4519d404..f6f79ad91 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 a4519d404..f6f79ad91 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 26a1c6d01..222d7e2c5 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-24-g4f1b