diff options
author | XScorpion2 <rcalt2vt@gmail.com> | 2019-05-07 18:22:46 -0500 |
---|---|---|
committer | MechMerlin <30334081+mechmerlin@users.noreply.github.com> | 2019-05-07 16:22:46 -0700 |
commit | af89752bffbaf5dcea30ea16be66b4d682701bc4 (patch) | |
tree | c82f2bc25409159a44778379db8b3a35afc47b8a /keyboards/dztech/dz40rgb | |
parent | c7f8548d9af2045996294602d2a4bd9a214ae23c (diff) | |
download | qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.tar.gz qmk_firmware-af89752bffbaf5dcea30ea16be66b4d682701bc4.zip |
rgb_led struct conversion (aka: Per led (key) type rgb matrix effects - part 2) (#5783)
* Initial conversion of the rgb_led struct
* Converting last keyboard & updating effects to take advantage of the new structure
* New struct should not be const
* Updated docs
* Changing define ___ for no led to NO_LED
* Missed converting some keymap usages of the old struct layout
Diffstat (limited to 'keyboards/dztech/dz40rgb')
-rw-r--r-- | keyboards/dztech/dz40rgb/dz40rgb.c | 163 | ||||
-rw-r--r-- | keyboards/dztech/dz40rgb/keymaps/default/keymap.c | 6 | ||||
-rw-r--r-- | keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c | 6 |
3 files changed, 42 insertions, 133 deletions
diff --git a/keyboards/dztech/dz40rgb/dz40rgb.c b/keyboards/dztech/dz40rgb/dz40rgb.c index 34bfc4366f..e5e39c92ab 100644 --- a/keyboards/dztech/dz40rgb/dz40rgb.c +++ b/keyboards/dztech/dz40rgb/dz40rgb.c @@ -52,7 +52,7 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {0, E_3, D_3, F_3}, {0, E_2, D_2, F_2}, {0, E_1, D_1, F_1}, - + {0, E_13, D_13, F_13}, {0, E_14, D_14, F_14}, @@ -71,70 +71,25 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - {{0|(11<<4)}, {20.36*11, 0}, 1}, - {{0|(10<<4)}, {20.36*10, 0}, 1}, - {{0|(9<<4)}, {20.36*9, 0}, 1}, - {{0|(8<<4)}, {20.36*8, 0}, 1}, - {{0|(7<<4)}, {20.36*7, 0}, 1}, - {{0|(6<<4)}, { 20.36*6, 0}, 1}, - {{0|(5<<4)}, { 20.36*5, 0}, 1}, - {{0|(4<<4)}, { 20.36*4, 0}, 1}, - {{0|(3<<4)}, { 20.36*3, 0}, 1}, - {{0|(2<<4)}, { 20.36*2, 0}, 1}, - {{0|(1<<4)}, { 20.36*1, 0}, 1}, - {{0|(0<<4)}, { 20.36*0, 0}, 1}, - - {{0|(12<<4)}, {20.36*11, 21.33*0.5}, 1}, - {{0|(13<<4)}, {20.36*0,21.33*0.5}, 1}, - - {{1|(11<<4)}, {20.36*11, 21.33}, 1}, - {{1|(10<<4)}, {20.36*10, 21.33}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33}, 4}, - {{1|(6<<4)}, { 20.36*6, 21.33}, 4}, - {{1|(5<<4)}, { 20.36*5, 21.33}, 4}, - {{1|(4<<4)}, { 20.36*4, 21.33}, 4}, - {{1|(3<<4)}, { 20.36*3, 21.33}, 4}, - {{1|(2<<4)}, { 20.36*2, 21.33}, 4}, - {{1|(1<<4)}, { 20.36*1, 21.33}, 4}, - {{1|(0<<4)}, { 20.36*0, 21.33}, 1}, - - {{1|(12<<4)}, {20.36*11, 21.33*1.5}, 1}, - {{1|(13<<4)}, {20.36*0,21.33*1.5}, 1}, +led_config_t g_led_config = { { + { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28 }, + { 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42 } +}, { + { 223, 0 }, { 203, 0 }, { 183, 0 }, { 162, 0 }, { 142, 0 }, { 122, 0 }, { 101, 0 }, { 81, 0 }, { 61, 0 }, { 40, 0 }, { 20, 0 }, { 0, 0 }, + { 223, 10 }, { 0, 10 }, { 223, 21 }, { 203, 21 }, { 183, 21 }, { 162, 21 }, { 142, 21 }, { 122, 21 }, { 101, 21 }, { 81, 21 }, { 61, 21 }, { 40, 21 }, + { 20, 21 }, { 0, 21 }, { 223, 31 }, { 0, 31 }, { 223, 42 }, { 203, 42 }, { 183, 42 }, { 162, 42 }, { 142, 42 }, { 122, 42 }, { 101, 42 }, { 81, 42 }, + { 61, 42 }, { 40, 42 }, { 20, 42 }, { 0, 42 }, { 223, 53 }, { 0, 53 }, { 223, 63 }, { 203, 63 }, { 183, 63 }, { 162, 63 }, { 142, 63 }, { 122, 63 }, + { 101, 63 }, { 81, 63 }, { 61, 63 }, { 40, 63 }, { 20, 63 }, { 0, 63 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1, 1 +} }; - {{2|(11<<4)}, {20.36*11, 21.33*2}, 1}, - {{2|(10<<4)}, {20.36*10, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(6<<4)}, { 20.36*6, 21.33*2}, 4}, - {{2|(5<<4)}, { 20.36*5, 21.33*2}, 4}, - {{2|(4<<4)}, { 20.36*4, 21.33*2}, 4}, - {{2|(3<<4)}, { 20.36*3, 21.33*2}, 4}, - {{2|(2<<4)}, { 20.36*2, 21.33*2}, 4}, - {{2|(1<<4)}, { 20.36*1, 21.33*2}, 4}, - {{2|(0<<4)}, { 20.36*0, 21.33*2}, 1}, - - {{2|(12<<4)}, {20.36*11, 21.33*2.5}, 1}, - {{2|(13<<4)}, {20.36*0,21.33*2.5}, 1}, - - {{3|(11<<4)}, {20.36*11, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(6<<4)}, { 20.36*6, 21.33*3}, 1}, - {{3|(5<<4)}, { 20.36*5, 21.33*3}, 1}, - {{3|(4<<4)}, { 20.36*4, 21.33*3}, 1}, - {{3|(3<<4)}, { 20.36*3, 21.33*3}, 1}, - {{3|(2<<4)}, { 20.36*2, 21.33*3}, 1}, - {{3|(1<<4)}, { 20.36*1, 21.33*3}, 1}, - {{3|(0<<4)}, { 20.36*0, 21.33*3}, 1} - -}; #else const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { /* Refer to IS31 manual for these locations @@ -205,69 +160,25 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { +led_config_t g_led_config = { { + { 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 }, + { 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14 }, + { 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28 }, + { 52, 51, 50, 49, 48, NO_LED, 47, 46, 45, 44, 43, 42 } +}, { + { 223, 0 }, { 203, 0 }, { 183, 0 }, { 162, 0 }, { 142, 0 }, { 122, 0 }, { 101, 0 }, { 81, 0 }, { 61, 0 }, { 40, 0 }, { 20, 0 }, { 0, 0 }, + { 223, 10 }, { 0, 10 }, { 223, 21 }, { 203, 21 }, { 183, 21 }, { 162, 21 }, { 142, 21 }, { 122, 21 }, { 101, 21 }, { 81, 21 }, { 61, 21 }, { 40, 21 }, + { 20, 21 }, { 0, 21 }, { 223, 31 }, { 0, 31 }, { 223, 42 }, { 203, 42 }, { 183, 42 }, { 162, 42 }, { 142, 42 }, { 122, 42 }, { 101, 42 }, { 81, 42 }, + { 61, 42 }, { 40, 42 }, { 20, 42 }, { 0, 42 }, { 223, 53 }, { 0, 53 }, { 223, 63 }, { 203, 63 }, { 183, 63 }, { 162, 63 }, { 142, 63 }, { 111, 63 }, + { 81, 63 }, { 61, 63 }, { 40, 63 }, { 20, 63 }, { 0, 63 } +}, { + 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 1, 1, 1, 1, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, + 1, 1, 1, 1, 1 +} }; - {{0|(11<<4)}, {20.36*11, 0}, 1}, - {{0|(10<<4)}, {20.36*10, 0}, 1}, - {{0|(9<<4)}, {20.36*9, 0}, 1}, - {{0|(8<<4)}, {20.36*8, 0}, 1}, - {{0|(7<<4)}, {20.36*7, 0}, 1}, - {{0|(6<<4)}, { 20.36*6, 0}, 1}, - {{0|(5<<4)}, { 20.36*5, 0}, 1}, - {{0|(4<<4)}, { 20.36*4, 0}, 1}, - {{0|(3<<4)}, { 20.36*3, 0}, 1}, - {{0|(2<<4)}, { 20.36*2, 0}, 1}, - {{0|(1<<4)}, { 20.36*1, 0}, 1}, - {{0|(0<<4)}, { 20.36*0, 0}, 1}, - - {{0|(12<<4)}, {20.36*11, 21.33*0.5}, 1}, - {{0|(13<<4)}, {20.36*0,21.33*0.5}, 1}, - - {{1|(11<<4)}, {20.36*11, 21.33}, 1}, - {{1|(10<<4)}, {20.36*10, 21.33}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33}, 4}, - {{1|(6<<4)}, { 20.36*6, 21.33}, 4}, - {{1|(5<<4)}, { 20.36*5, 21.33}, 4}, - {{1|(4<<4)}, { 20.36*4, 21.33}, 4}, - {{1|(3<<4)}, { 20.36*3, 21.33}, 4}, - {{1|(2<<4)}, { 20.36*2, 21.33}, 4}, - {{1|(1<<4)}, { 20.36*1, 21.33}, 4}, - {{1|(0<<4)}, { 20.36*0, 21.33}, 1}, - - {{1|(12<<4)}, {20.36*11, 21.33*1.5}, 1}, - {{1|(13<<4)}, {20.36*0,21.33*1.5}, 1}, - - {{2|(11<<4)}, {20.36*11, 21.33*2}, 1}, - {{2|(10<<4)}, {20.36*10, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(6<<4)}, { 20.36*6, 21.33*2}, 4}, - {{2|(5<<4)}, { 20.36*5, 21.33*2}, 4}, - {{2|(4<<4)}, { 20.36*4, 21.33*2}, 4}, - {{2|(3<<4)}, { 20.36*3, 21.33*2}, 4}, - {{2|(2<<4)}, { 20.36*2, 21.33*2}, 4}, - {{2|(1<<4)}, { 20.36*1, 21.33*2}, 4}, - {{2|(0<<4)}, { 20.36*0, 21.33*2}, 1}, - - {{2|(12<<4)}, {20.36*11, 21.33*2.5}, 1}, - {{2|(13<<4)}, {20.36*0,21.33*2.5}, 1}, - - {{3|(11<<4)}, {20.36*11, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(6<<4)}, { 20.36*5.5, 21.33*3}, 1}, - {{3|(4<<4)}, { 20.36*4, 21.33*3}, 1}, - {{3|(3<<4)}, { 20.36*3, 21.33*3}, 1}, - {{3|(2<<4)}, { 20.36*2, 21.33*3}, 1}, - {{3|(1<<4)}, { 20.36*1, 21.33*3}, 1}, - {{3|(0<<4)}, { 20.36*0, 21.33*3}, 1} - -}; #endif diff --git a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c index 59b917121c..650c178a7e 100644 --- a/keyboards/dztech/dz40rgb/keymaps/default/keymap.c +++ b/keyboards/dztech/dz40rgb/keymaps/default/keymap.c @@ -31,11 +31,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { ), }; + +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } diff --git a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c index 5613e35000..80741b19c4 100644 --- a/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c +++ b/keyboards/dztech/dz40rgb/keymaps/split_space/keymap.c @@ -53,12 +53,10 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { - +extern led_config_t g_led_config; void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { - rgb_led led; for (int i = 0; i < DRIVER_LED_TOTAL; i++) { - led = g_rgb_leds[i]; - if (HAS_FLAGS(led.flags, LED_FLAG_MODIFIER)) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { rgb_matrix_set_color( i, red, green, blue ); } } |