summaryrefslogtreecommitdiff
path: root/keyboards/massdrop/ctrl
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-04-30 00:18:50 +0200
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-04-29 15:18:50 -0700
commita7113c8ed090d0ac647f30ee9b8ef41252e568ed (patch)
tree24d33db679b4d1357efef2784e69fea48e98d0ed /keyboards/massdrop/ctrl
parent1d784f0f9575b70e35c9c8338b0ff80dc7316d7e (diff)
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
Diffstat (limited to 'keyboards/massdrop/ctrl')
-rw-r--r--keyboards/massdrop/ctrl/config.h1
-rw-r--r--keyboards/massdrop/ctrl/config_led.c236
-rw-r--r--keyboards/massdrop/ctrl/keymaps/default/keymap.c26
-rw-r--r--keyboards/massdrop/ctrl/keymaps/mac/keymap.c26
4 files changed, 170 insertions, 119 deletions
diff --git a/keyboards/massdrop/ctrl/config.h b/keyboards/massdrop/ctrl/config.h
index df2e509216..9b9f98f5fe 100644
--- a/keyboards/massdrop/ctrl/config.h
+++ b/keyboards/massdrop/ctrl/config.h
@@ -123,6 +123,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#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/ctrl/config_led.c b/keyboards/massdrop/ctrl/config_led.c
index afdbf3a222..20d9c649ec 100644
--- a/keyboards/massdrop/ctrl/config_led.c
+++ b/keyboards/massdrop/ctrl/config_led.c
@@ -5,133 +5,133 @@
#include "rgb_matrix.h"
#include "config_led.h"
-const rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
+rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = {
// KC_ESC, KC_F1, KC_F2, KC_F3, KC_F4, KC_F5, KC_F6, KC_F7, KC_F8, KC_F9, KC_F10, KC_F11, KC_F12, KC_PSCR, KC_SLCK, KC_PAUS
- { { 0|(0<<4) }, { 7, 5 }, 0 },
- { { 0|(1<<4) }, { 31, 5 }, 0 },
- { { 0|(2<<4) }, { 43, 5 }, 0 },
- { { 0|(3<<4) }, { 55, 5 }, 0 },
- { { 0|(4<<4) }, { 67, 5 }, 0 },
- { { 0|(5<<4) }, { 85, 5 }, 0 },
- { { 0|(6<<4) }, { 97, 5 }, 0 },
- { { 0|(7<<4) }, { 109, 5 }, 0 },
- { { 6|(0<<4) }, { 121, 5 }, 0 },
- { { 6|(1<<4) }, { 139, 5 }, 0 },
- { { 6|(2<<4) }, { 151, 5 }, 0 },
- { { 6|(3<<4) }, { 163, 5 }, 0 },
- { { 6|(4<<4) }, { 175, 5 }, 0 },
- { { 6|(5<<4) }, { 193, 5 }, 0 },
+ { { 0|(0<<4) }, { 7, 5 }, 4 },
+ { { 0|(1<<4) }, { 31, 5 }, 4 },
+ { { 0|(2<<4) }, { 43, 5 }, 4 },
+ { { 0|(3<<4) }, { 55, 5 }, 4 },
+ { { 0|(4<<4) }, { 67, 5 }, 4 },
+ { { 0|(5<<4) }, { 85, 5 }, 4 },
+ { { 0|(6<<4) }, { 97, 5 }, 4 },
+ { { 0|(7<<4) }, { 109, 5 }, 4 },
+ { { 6|(0<<4) }, { 121, 5 }, 4 },
+ { { 6|(1<<4) }, { 139, 5 }, 4 },
+ { { 6|(2<<4) }, { 151, 5 }, 4 },
+ { { 6|(3<<4) }, { 163, 5 }, 4 },
+ { { 6|(4<<4) }, { 175, 5 }, 4 },
+ { { 6|(5<<4) }, { 193, 5 }, 4 },
{ { 6|(6<<4) }, { 205, 5 }, 1 },
- { { 6|(7<<4) }, { 217, 5 }, 0 },
+ { { 6|(7<<4) }, { 217, 5 }, 4 },
// KC_GRV, KC_1, KC_2, KC_3, KC_4, KC_5, KC_6, KC_7, KC_8, KC_9, KC_0, KC_MINS, KC_EQL, KC_BSPC, KC_INS, KC_HOME, KC_PGUP
- { { 1|(0<<4) }, { 7, 20 }, 0 },
- { { 1|(1<<4) }, { 19, 20 }, 0 },
- { { 1|(2<<4) }, { 31, 20 }, 0 },
- { { 1|(3<<4) }, { 43, 20 }, 0 },
- { { 1|(4<<4) }, { 55, 20 }, 0 },
- { { 1|(5<<4) }, { 67, 20 }, 0 },
- { { 1|(6<<4) }, { 79, 20 }, 0 },
- { { 1|(7<<4) }, { 91, 20 }, 0 },
- { { 7|(0<<4) }, { 103, 20 }, 0 },
- { { 7|(1<<4) }, { 115, 20 }, 0 },
- { { 7|(2<<4) }, { 127, 20 }, 0 },
- { { 7|(3<<4) }, { 139, 20 }, 0 },
- { { 7|(4<<4) }, { 151, 20 }, 0 },
- { { 7|(5<<4) }, { 169, 20 }, 0 },
- { { 7|(6<<4) }, { 193, 20 }, 0 },
- { { 7|(7<<4) }, { 205, 20 }, 0 },
- { { 9|(7<<4) }, { 217, 20 }, 0 },
+ { { 1|(0<<4) }, { 7, 20 }, 4 },
+ { { 1|(1<<4) }, { 19, 20 }, 4 },
+ { { 1|(2<<4) }, { 31, 20 }, 4 },
+ { { 1|(3<<4) }, { 43, 20 }, 4 },
+ { { 1|(4<<4) }, { 55, 20 }, 4 },
+ { { 1|(5<<4) }, { 67, 20 }, 4 },
+ { { 1|(6<<4) }, { 79, 20 }, 4 },
+ { { 1|(7<<4) }, { 91, 20 }, 4 },
+ { { 7|(0<<4) }, { 103, 20 }, 4 },
+ { { 7|(1<<4) }, { 115, 20 }, 4 },
+ { { 7|(2<<4) }, { 127, 20 }, 4 },
+ { { 7|(3<<4) }, { 139, 20 }, 4 },
+ { { 7|(4<<4) }, { 151, 20 }, 4 },
+ { { 7|(5<<4) }, { 169, 20 }, 4 },
+ { { 7|(6<<4) }, { 193, 20 }, 4 },
+ { { 7|(7<<4) }, { 205, 20 }, 4 },
+ { { 9|(7<<4) }, { 217, 20 }, 4 },
// KC_TAB, KC_Q, KC_W, KC_E, KC_R, KC_T, KC_Y, KC_U, KC_I, KC_O, KC_P, KC_LBRC, KC_RBRC, KC_BSLS, KC_DEL, KC_END, KC_PGDN
- { { 2|(0<<4) }, { 10, 30 }, 0 },
- { { 2|(1<<4) }, { 25, 30 }, 0 },
- { { 2|(2<<4) }, { 37, 30 }, 0 },
- { { 2|(3<<4) }, { 49, 30 }, 0 },
- { { 2|(4<<4) }, { 61, 30 }, 0 },
- { { 2|(5<<4) }, { 73, 30 }, 0 },
- { { 2|(6<<4) }, { 85, 30 }, 0 },
- { { 2|(7<<4) }, { 97, 30 }, 0 },
- { { 8|(0<<4) }, { 109, 30 }, 0 },
- { { 8|(1<<4) }, { 121, 30 }, 0 },
- { { 8|(2<<4) }, { 133, 30 }, 0 },
- { { 8|(3<<4) }, { 145, 30 }, 0 },
- { { 8|(4<<4) }, { 157, 30 }, 0 },
- { { 8|(5<<4) }, { 172, 30 }, 0 },
- { { 8|(6<<4) }, { 193, 30 }, 0 },
- { { 8|(7<<4) }, { 205, 30 }, 0 },
- { { 9|(6<<4) }, { 217, 30 }, 0 },
+ { { 2|(0<<4) }, { 10, 30 }, 4 },
+ { { 2|(1<<4) }, { 25, 30 }, 4 },
+ { { 2|(2<<4) }, { 37, 30 }, 4 },
+ { { 2|(3<<4) }, { 49, 30 }, 4 },
+ { { 2|(4<<4) }, { 61, 30 }, 4 },
+ { { 2|(5<<4) }, { 73, 30 }, 4 },
+ { { 2|(6<<4) }, { 85, 30 }, 4 },
+ { { 2|(7<<4) }, { 97, 30 }, 4 },
+ { { 8|(0<<4) }, { 109, 30 }, 4 },
+ { { 8|(1<<4) }, { 121, 30 }, 4 },
+ { { 8|(2<<4) }, { 133, 30 }, 4 },
+ { { 8|(3<<4) }, { 145, 30 }, 4 },
+ { { 8|(4<<4) }, { 157, 30 }, 4 },
+ { { 8|(5<<4) }, { 172, 30 }, 4 },
+ { { 8|(6<<4) }, { 193, 30 }, 4 },
+ { { 8|(7<<4) }, { 205, 30 }, 4 },
+ { { 9|(6<<4) }, { 217, 30 }, 4 },
// KC_CAPS, KC_A, KC_S, KC_D, KC_F, KC_G, KC_H, KC_J, KC_K, KC_L, KC_SCLN, KC_QUOT, KC_ENT
{ { 3|(0<<4) }, { 11, 39 }, 1 },
- { { 3|(1<<4) }, { 28, 39 }, 0 },
- { { 3|(2<<4) }, { 40, 39 }, 0 },
- { { 3|(3<<4) }, { 52, 39 }, 0 },
- { { 3|(4<<4) }, { 64, 39 }, 0 },
- { { 3|(5<<4) }, { 76, 39 }, 0 },
- { { 3|(6<<4) }, { 88, 39 }, 0 },
- { { 3|(7<<4) }, { 100, 39 }, 0 },
- { { 9|(0<<4) }, { 112, 39 }, 0 },
- { { 9|(1<<4) }, { 124, 39 }, 0 },
- { { 9|(2<<4) }, { 136, 39 }, 0 },
- { { 9|(3<<4) }, { 148, 39 }, 0 },
- { { 9|(4<<4) }, { 168, 39 }, 0 },
+ { { 3|(1<<4) }, { 28, 39 }, 4 },
+ { { 3|(2<<4) }, { 40, 39 }, 4 },
+ { { 3|(3<<4) }, { 52, 39 }, 4 },
+ { { 3|(4<<4) }, { 64, 39 }, 4 },
+ { { 3|(5<<4) }, { 76, 39 }, 4 },
+ { { 3|(6<<4) }, { 88, 39 }, 4 },
+ { { 3|(7<<4) }, { 100, 39 }, 4 },
+ { { 9|(0<<4) }, { 112, 39 }, 4 },
+ { { 9|(1<<4) }, { 124, 39 }, 4 },
+ { { 9|(2<<4) }, { 136, 39 }, 4 },
+ { { 9|(3<<4) }, { 148, 39 }, 4 },
+ { { 9|(4<<4) }, { 168, 39 }, 4 },
// KC_LSFT, KC_Z, KC_X, KC_C, KC_V, KC_B, KC_N, KC_M, KC_COMM, KC_DOT, KC_SLSH, KC_RSFT, KC_UP
- { { 4|(0<<4) }, { 14, 49 }, 0 },
- { { 4|(1<<4) }, { 34, 49 }, 0 },
- { { 4|(2<<4) }, { 46, 49 }, 0 },
- { { 4|(3<<4) }, { 58, 49 }, 0 },
- { { 4|(4<<4) }, { 70, 49 }, 0 },
- { { 4|(5<<4) }, { 82, 49 }, 0 },
- { { 4|(6<<4) }, { 94, 49 }, 0 },
- { { 4|(7<<4) }, { 106, 49 }, 0 },
- { { 10|(0<<4) }, { 118, 49 }, 0 },
- { { 10|(1<<4) }, { 130, 49 }, 0 },
- { { 10|(2<<4) }, { 142, 49 }, 0 },
- { { 10|(3<<4) }, { 165, 49 }, 0 },
- { { 9|(5<<4) }, { 205, 49 }, 0 },
+ { { 4|(0<<4) }, { 14, 49 }, 4 },
+ { { 4|(1<<4) }, { 34, 49 }, 4 },
+ { { 4|(2<<4) }, { 46, 49 }, 4 },
+ { { 4|(3<<4) }, { 58, 49 }, 4 },
+ { { 4|(4<<4) }, { 70, 49 }, 4 },
+ { { 4|(5<<4) }, { 82, 49 }, 4 },
+ { { 4|(6<<4) }, { 94, 49 }, 4 },
+ { { 4|(7<<4) }, { 106, 49 }, 4 },
+ { { 10|(0<<4) }, { 118, 49 }, 4 },
+ { { 10|(1<<4) }, { 130, 49 }, 4 },
+ { { 10|(2<<4) }, { 142, 49 }, 4 },
+ { { 10|(3<<4) }, { 165, 49 }, 4 },
+ { { 9|(5<<4) }, { 205, 49 }, 4 },
// KC_LCTL, KC_LGUI, KC_LALT, KC_SPC, KC_RALT, MO(1), KC_APP, KC_RCTL, KC_LEFT, KC_DOWN, KC_RGHT
- { { 5|(0<<4) }, { 8, 59 }, 0 },
- { { 5|(1<<4) }, { 23, 59 }, 0 },
- { { 5|(2<<4) }, { 38, 59 }, 0 },
- { { 5|(3<<4) }, { 83, 59 }, 0 },
- { { 5|(4<<4) }, { 129, 59 }, 0 },
- { { 5|(5<<4) }, { 144, 59 }, 0 },
- { { 5|(6<<4) }, { 159, 59 }, 0 },
- { { 5|(7<<4) }, { 174, 59 }, 0 },
- { { 10|(4<<4) }, { 193, 59 }, 0 },
- { { 10|(5<<4) }, { 205, 59 }, 0 },
- { { 10|(6<<4) }, { 217, 59 }, 0 },
+ { { 5|(0<<4) }, { 8, 59 }, 4 },
+ { { 5|(1<<4) }, { 23, 59 }, 4 },
+ { { 5|(2<<4) }, { 38, 59 }, 4 },
+ { { 5|(3<<4) }, { 83, 59 }, 4 },
+ { { 5|(4<<4) }, { 129, 59 }, 4 },
+ { { 5|(5<<4) }, { 144, 59 }, 4 },
+ { { 5|(6<<4) }, { 159, 59 }, 4 },
+ { { 5|(7<<4) }, { 174, 59 }, 4 },
+ { { 10|(4<<4) }, { 193, 59 }, 4 },
+ { { 10|(5<<4) }, { 205, 59 }, 4 },
+ { { 10|(6<<4) }, { 217, 59 }, 4 },
// Underglow / Border
- { { 0xFF }, { 222, 64 }, 0 },
- { { 0xFF }, { 204, 64 }, 0 },
- { { 0xFF }, { 186, 64 }, 0 },
- { { 0xFF }, { 167, 64 }, 0 },
- { { 0xFF }, { 149, 64 }, 0 },
- { { 0xFF }, { 130, 64 }, 0 },
- { { 0xFF }, { 112, 64 }, 0 },
- { { 0xFF }, { 94, 64 }, 0 },
- { { 0xFF }, { 75, 64 }, 0 },
- { { 0xFF }, { 57, 64 }, 0 },
- { { 0xFF }, { 38, 64 }, 0 },
- { { 0xFF }, { 20, 64 }, 0 },
- { { 0xFF }, { 0, 64 }, 0 },
- { { 0xFF }, { 0, 47 }, 0 },
- { { 0xFF }, { 0, 32 }, 0 },
- { { 0xFF }, { 0, 17 }, 0 },
- { { 0xFF }, { 0, 0 }, 0 },
- { { 0xFF }, { 20, 0 }, 0 },
- { { 0xFF }, { 38, 0 }, 0 },
- { { 0xFF }, { 57, 0 }, 0 },
- { { 0xFF }, { 75, 0 }, 0 },
- { { 0xFF }, { 94, 0 }, 0 },
- { { 0xFF }, { 112, 0 }, 0 },
- { { 0xFF }, { 130, 0 }, 0 },
- { { 0xFF }, { 149, 0 }, 0 },
- { { 0xFF }, { 167, 0 }, 0 },
- { { 0xFF }, { 186, 0 }, 0 },
- { { 0xFF }, { 204, 0 }, 0 },
- { { 0xFF }, { 222, 1 }, 0 },
- { { 0xFF }, { 224, 17 }, 0 },
- { { 0xFF }, { 224, 32 }, 0 },
- { { 0xFF }, { 224, 47 }, 0 },
+ { { 0xFF }, { 222, 64 }, 2 },
+ { { 0xFF }, { 204, 64 }, 2 },
+ { { 0xFF }, { 186, 64 }, 2 },
+ { { 0xFF }, { 167, 64 }, 2 },
+ { { 0xFF }, { 149, 64 }, 2 },
+ { { 0xFF }, { 130, 64 }, 2 },
+ { { 0xFF }, { 112, 64 }, 2 },
+ { { 0xFF }, { 94, 64 }, 2 },
+ { { 0xFF }, { 75, 64 }, 2 },
+ { { 0xFF }, { 57, 64 }, 2 },
+ { { 0xFF }, { 38, 64 }, 2 },
+ { { 0xFF }, { 20, 64 }, 2 },
+ { { 0xFF }, { 0, 64 }, 2 },
+ { { 0xFF }, { 0, 47 }, 2 },
+ { { 0xFF }, { 0, 32 }, 2 },
+ { { 0xFF }, { 0, 17 }, 2 },
+ { { 0xFF }, { 0, 0 }, 2 },
+ { { 0xFF }, { 20, 0 }, 2 },
+ { { 0xFF }, { 38, 0 }, 2 },
+ { { 0xFF }, { 57, 0 }, 2 },
+ { { 0xFF }, { 75, 0 }, 2 },
+ { { 0xFF }, { 94, 0 }, 2 },
+ { { 0xFF }, { 112, 0 }, 2 },
+ { { 0xFF }, { 130, 0 }, 2 },
+ { { 0xFF }, { 149, 0 }, 2 },
+ { { 0xFF }, { 167, 0 }, 2 },
+ { { 0xFF }, { 186, 0 }, 2 },
+ { { 0xFF }, { 204, 0 }, 2 },
+ { { 0xFF }, { 222, 1 }, 2 },
+ { { 0xFF }, { 224, 17 }, 2 },
+ { { 0xFF }, { 224, 32 }, 2 },
+ { { 0xFF }, { 224, 47 }, 2 },
};
#ifdef USB_LED_INDICATOR_ENABLE
diff --git a/keyboards/massdrop/ctrl/keymaps/default/keymap.c b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
index 182abbbad4..53c96d95d0 100644
--- a/keyboards/massdrop/ctrl/keymaps/default/keymap.c
+++ b/keyboards/massdrop/ctrl/keymaps/default/keymap.c
@@ -98,6 +98,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/ctrl/keymaps/mac/keymap.c b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c
index 41cf827572..79fe7388af 100644
--- a/keyboards/massdrop/ctrl/keymaps/mac/keymap.c
+++ b/keyboards/massdrop/ctrl/keymaps/mac/keymap.c
@@ -98,6 +98,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
}