aboutsummaryrefslogtreecommitdiff
path: root/keyboards
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-05-10 18:55:02 -0500
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-05-10 16:55:02 -0700
commit62ba66d61821fec6a5ad3bdccdf738e15e082461 (patch)
tree4b0fb100299a7a7e9a51cbbe96da94df8a57483f /keyboards
parentfebaf9dec42ce4d4ade316f811145a291137ee94 (diff)
downloadqmk_firmware-62ba66d61821fec6a5ad3bdccdf738e15e082461.tar.gz
qmk_firmware-62ba66d61821fec6a5ad3bdccdf738e15e082461.zip
Cleanup/rgb matrix (#5811)
* clean up rgb matrix extern usage Moved rgb matrix boiler plate into macros Rebased onto typing heatmap pr * Fixing the reversed frame buffer access in digital rain * Fixing digital rain & typing heatmap if keyreactive effects are not enabled * Apply suggestions from code review Co-Authored-By: Drashna Jaelre <drashna@live.com> * Adding parenthesizes to DRIVER_LED_TOTAL where necessary * Updated docs * added notes about parentheses
Diffstat (limited to 'keyboards')
-rw-r--r--keyboards/dztech/dz40rgb/keymaps/default/keymap.c2
-rw-r--r--keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/default/keymap.c1
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/iso/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c2
-rw-r--r--keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c4
-rw-r--r--keyboards/dztech/dz65rgb/config.h2
-rw-r--r--keyboards/dztech/dz65rgb/keymaps/default/keymap.c1
-rw-r--r--keyboards/ergodox_ez/config.h2
-rw-r--r--keyboards/hs60/v1/config.h2
-rw-r--r--keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c2
-rw-r--r--keyboards/planck/keymaps/tom/keymap.c4
-rw-r--r--keyboards/planck/light/config.h2
-rw-r--r--keyboards/sol/keymaps/xulkal/keymap.c1
17 files changed, 5 insertions, 30 deletions
diff --git a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c
index 650c178a7..e4f56f5a8 100644
--- a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c
+++ b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -32,7 +31,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
32 31
33}; 32};
34 33
35extern led_config_t g_led_config;
36void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 34void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
37 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 35 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
38 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 36 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c
index 80741b19c..04c31bab1 100644
--- a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c
+++ b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -53,7 +52,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
53 52
54 53
55 54
56extern led_config_t g_led_config;
57void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 55void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
58 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 56 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
59 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 57 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c b/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c
index 584f035ef..8633b1836 100644
--- a/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/ansi/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -38,7 +37,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 37 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39 }; 38 };
40 39
41extern led_config_t g_led_config;
42void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 40void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
43 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 41 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
44 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 42 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz60rgb/keymaps/default/keymap.c b/keyboards/dztech/dz60rgb/keymaps/default/keymap.c
index c0bc1b89b..464d92e02 100644
--- a/keyboards/dztech/dz60rgb/keymaps/default/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/default/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
diff --git a/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c b/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c
index 5a7a56801..091343ac3 100644
--- a/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/hhkb/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -39,7 +38,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 }; 38 };
40 39
41 40
42extern led_config_t g_led_config;
43void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 41void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
44 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 42 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
45 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 43 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c b/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c
index 34c1752ff..bc8a6fa36 100644
--- a/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/hhkb_iso/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -39,7 +38,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
39 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS), 38 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS),
40 }; 39 };
41 40
42extern led_config_t g_led_config;
43void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 41void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
44 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 42 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
45 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 43 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c b/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c
index 3a90d2f33..61a3a2286 100644
--- a/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/iso/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -38,7 +37,6 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
38 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS), 37 KC_TRNS, KC_TRNS, KC_TRNS, TO(0), KC_TRNS, KC_TRNS, KC_TRNS, KC_TRNS),
39 }; 38 };
40 39
41extern led_config_t g_led_config;
42void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { 40void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
43 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 41 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
44 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 42 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
diff --git a/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c b/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c
index 5c725f5dc..600ac8619 100644
--- a/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/matthewrobo/keymap.c
@@ -1,6 +1,5 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2 2
3extern bool g_suspend_state;
4 3
5enum dz60rgb_layers { 4enum dz60rgb_layers {
6 _QWERTY, 5 _QWERTY,
@@ -26,7 +25,6 @@ enum dz60rgb_keycodes {
26#define _V_V_V_ KC_TRNS 25#define _V_V_V_ KC_TRNS
27#define LT_CAPS LT(_NAV, KC_CAPS) 26#define LT_CAPS LT(_NAV, KC_CAPS)
28#define LT_DEL LT(_RGB, KC_DEL) 27#define LT_DEL LT(_RGB, KC_DEL)
29extern rgb_config_t rgb_matrix_config;
30extern bool autoshift_enabled; 28extern bool autoshift_enabled;
31#define MT_SLSH RSFT_T(KC_SLSH) 29#define MT_SLSH RSFT_T(KC_SLSH)
32#define MT_APP RALT_T(KC_APP) 30#define MT_APP RALT_T(KC_APP)
diff --git a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c
index a6d1e226b..a7f1dd73e 100644
--- a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c
+++ b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5#define _LAYER2 2 4#define _LAYER2 2
@@ -50,8 +49,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
50 49
51 50
52 51
53extern led_config_t g_led_config; 52void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) {
54void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) {
55 for (int i = 0; i < DRIVER_LED_TOTAL; i++) { 53 for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
56 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { 54 if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) {
57 rgb_matrix_set_color( i, red, green, blue ); 55 rgb_matrix_set_color( i, red, green, blue );
diff --git a/keyboards/dztech/dz65rgb/config.h b/keyboards/dztech/dz65rgb/config.h
index 8ef9c2390..f4c1f1114 100644
--- a/keyboards/dztech/dz65rgb/config.h
+++ b/keyboards/dztech/dz65rgb/config.h
@@ -26,4 +26,4 @@
26#define DRIVER_COUNT 2 26#define DRIVER_COUNT 2
27#define DRIVER_1_LED_TOTAL 35 27#define DRIVER_1_LED_TOTAL 35
28#define DRIVER_2_LED_TOTAL 33 28#define DRIVER_2_LED_TOTAL 33
29#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL 29#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
diff --git a/keyboards/dztech/dz65rgb/keymaps/default/keymap.c b/keyboards/dztech/dz65rgb/keymaps/default/keymap.c
index bce9118f8..dae08a48c 100644
--- a/keyboards/dztech/dz65rgb/keymaps/default/keymap.c
+++ b/keyboards/dztech/dz65rgb/keymaps/default/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3#define _LAYER0 0 2#define _LAYER0 0
4#define _LAYER1 1 3#define _LAYER1 1
5const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { 4const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
diff --git a/keyboards/ergodox_ez/config.h b/keyboards/ergodox_ez/config.h
index cbf7f8aaa..d22836bd8 100644
--- a/keyboards/ergodox_ez/config.h
+++ b/keyboards/ergodox_ez/config.h
@@ -107,7 +107,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
107#define DRIVER_COUNT 2 107#define DRIVER_COUNT 2
108#define DRIVER_1_LED_TOTAL 24 108#define DRIVER_1_LED_TOTAL 24
109#define DRIVER_2_LED_TOTAL 24 109#define DRIVER_2_LED_TOTAL 24
110#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL 110#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
111 111
112// #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF 112// #define RGBLIGHT_COLOR_LAYER_0 0x00, 0x00, 0xFF
113/* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */ 113/* #define RGBLIGHT_COLOR_LAYER_1 0x00, 0x00, 0xFF */
diff --git a/keyboards/hs60/v1/config.h b/keyboards/hs60/v1/config.h
index 528f08bb9..ee546f3f1 100644
--- a/keyboards/hs60/v1/config.h
+++ b/keyboards/hs60/v1/config.h
@@ -134,4 +134,4 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
134#define DRIVER_2_LED_TOTAL 32 134#define DRIVER_2_LED_TOTAL 32
135#endif 135#endif
136 136
137#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL 137#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
diff --git a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c
index b4339a4d4..2823292e6 100644
--- a/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c
+++ b/keyboards/massdrop/ctrl/keymaps/matthewrobo/keymap.c
@@ -1,5 +1,4 @@
1#include QMK_KEYBOARD_H 1#include QMK_KEYBOARD_H
2extern bool g_suspend_state;
3 2
4enum ctrl_layers { 3enum ctrl_layers {
5 _QWERTY, 4 _QWERTY,
@@ -31,7 +30,6 @@ enum ctrl_keycodes {
31#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode 30#define TG_NKRO MAGIC_TOGGLE_NKRO //Toggle 6KRO / NKRO mode
32#define LT_CAPS LT(_NAV, KC_CAPS) 31#define LT_CAPS LT(_NAV, KC_CAPS)
33#define _V_V_V_ KC_TRNS 32#define _V_V_V_ KC_TRNS
34extern rgb_config_t rgb_matrix_config;
35extern bool autoshift_enabled; 33extern bool autoshift_enabled;
36 34
37 35
diff --git a/keyboards/planck/keymaps/tom/keymap.c b/keyboards/planck/keymaps/tom/keymap.c
index 0ffff4e69..e6a1411ee 100644
--- a/keyboards/planck/keymaps/tom/keymap.c
+++ b/keyboards/planck/keymaps/tom/keymap.c
@@ -224,10 +224,6 @@ bool music_mask_user(uint16_t keycode) {
224 } 224 }
225} 225}
226 226
227#ifdef RGB_MATRIX_ENABLE
228extern led_config_t g_led_config;
229#endif
230
231void rgb_matrix_indicators_user(void) { 227void rgb_matrix_indicators_user(void) {
232 #ifdef RGB_MATRIX_ENABLE 228 #ifdef RGB_MATRIX_ENABLE
233 switch (biton32(layer_state)) { 229 switch (biton32(layer_state)) {
diff --git a/keyboards/planck/light/config.h b/keyboards/planck/light/config.h
index 17c015ed0..c7bc9cb1a 100644
--- a/keyboards/planck/light/config.h
+++ b/keyboards/planck/light/config.h
@@ -39,7 +39,7 @@
39#define DRIVER_COUNT 2 39#define DRIVER_COUNT 2
40#define DRIVER_1_LED_TOTAL 25 40#define DRIVER_1_LED_TOTAL 25
41#define DRIVER_2_LED_TOTAL 24 41#define DRIVER_2_LED_TOTAL 24
42#define DRIVER_LED_TOTAL DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL 42#define DRIVER_LED_TOTAL (DRIVER_1_LED_TOTAL + DRIVER_2_LED_TOTAL)
43 43
44 44
45#endif 45#endif
diff --git a/keyboards/sol/keymaps/xulkal/keymap.c b/keyboards/sol/keymaps/xulkal/keymap.c
index 111e8aa32..3bbd57f70 100644
--- a/keyboards/sol/keymaps/xulkal/keymap.c
+++ b/keyboards/sol/keymaps/xulkal/keymap.c
@@ -92,7 +92,6 @@ static void render_logo(void) {
92 oled_write_P(sol_logo, false); 92 oled_write_P(sol_logo, false);
93} 93}
94 94
95extern rgb_config_t rgb_matrix_config;
96 95
97static void render_status(void) { 96static void render_status(void) {
98 // Render to mode icon 97 // Render to mode icon