diff options
Diffstat (limited to 'keyboards/planck')
-rw-r--r-- | keyboards/planck/ez/ez.c | 78 | ||||
-rw-r--r-- | keyboards/planck/keymaps/tom/keymap.c | 11 | ||||
-rw-r--r-- | keyboards/planck/light/light.c | 87 |
3 files changed, 55 insertions, 121 deletions
diff --git a/keyboards/planck/ez/ez.c b/keyboards/planck/ez/ez.c index 94f5071896..3ad694c4a3 100644 --- a/keyboards/planck/ez/ez.c +++ b/keyboards/planck/ez/ez.c @@ -79,63 +79,27 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - /*{row | col << 4} - | {x=0..224, y=0..64} - | | flags - | | | */ - {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, - {{0|(2<<4)}, {20.36*2, 21.33*0}, 4}, - {{0|(3<<4)}, {20.36*3, 21.33*0}, 4}, - {{0|(4<<4)}, {20.36*4, 21.33*0}, 4}, - {{0|(5<<4)}, {20.36*5, 21.33*0}, 4}, - {{4|(0<<4)}, {20.36*6, 21.33*0}, 4}, - {{4|(1<<4)}, {20.36*7, 21.33*0}, 4}, - {{4|(2<<4)}, {20.36*8, 21.33*0}, 4}, - {{4|(3<<4)}, {20.36*9, 21.33*0}, 4}, - {{4|(4<<4)}, {20.36*10,21.33*0}, 4}, - {{4|(5<<4)}, {20.36*11,21.33*0}, 1}, - - {{1|(0<<4)}, {20.36*0, 21.33*1}, 1}, - {{1|(1<<4)}, {20.36*1, 21.33*1}, 4}, - {{1|(2<<4)}, {20.36*2, 21.33*1}, 4}, - {{1|(3<<4)}, {20.36*3, 21.33*1}, 4}, - {{1|(4<<4)}, {20.36*4, 21.33*1}, 4}, - {{1|(5<<4)}, {20.36*5, 21.33*1}, 4}, - {{5|(0<<4)}, {20.36*6, 21.33*1}, 4}, - {{5|(1<<4)}, {20.36*7, 21.33*1}, 4}, - {{5|(2<<4)}, {20.36*8, 21.33*1}, 4}, - {{5|(3<<4)}, {20.36*9, 21.33*1}, 4}, - {{5|(4<<4)}, {20.36*10,21.33*1}, 4}, - {{5|(5<<4)}, {20.36*11,21.33*1}, 1}, - - {{2|(0<<4)}, {20.36*0, 21.33*2}, 1}, - {{2|(1<<4)}, {20.36*1, 21.33*2}, 4}, - {{2|(2<<4)}, {20.36*2, 21.33*2}, 4}, - {{2|(3<<4)}, {20.36*3, 21.33*2}, 4}, - {{2|(4<<4)}, {20.36*4, 21.33*2}, 4}, - {{2|(5<<4)}, {20.36*5, 21.33*2}, 4}, - {{6|(0<<4)}, {20.36*6, 21.33*2}, 4}, - {{6|(1<<4)}, {20.36*7, 21.33*2}, 4}, - {{6|(2<<4)}, {20.36*8, 21.33*2}, 4}, - {{6|(3<<4)}, {20.36*9, 21.33*2}, 4}, - {{6|(4<<4)}, {20.36*10,21.33*2}, 4}, - {{6|(5<<4)}, {20.36*11,21.33*2}, 1}, - - {{3|(0<<4)}, {20.36*0, 21.33*3}, 1}, - {{3|(1<<4)}, {20.36*1, 21.33*3}, 1}, - {{3|(2<<4)}, {20.36*2, 21.33*3}, 1}, - {{7|(3<<4)}, {20.36*3, 21.33*3}, 1}, - {{7|(4<<4)}, {20.36*4, 21.33*3}, 1}, - {{7|(5<<4)}, {20.36*5.5,21.33*3}, 4}, - {{7|(0<<4)}, {20.36*7, 21.33*3}, 1}, - {{7|(1<<4)}, {20.36*8, 21.33*3}, 1}, - {{7|(2<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(3<<4)}, {20.36*10,21.33*3}, 1}, - {{3|(4<<4)}, {20.36*11,21.33*3}, 1} -}; +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5 }, + { 12, 13, 14, 15, 16, 17 }, + { 24, 25, 26, 27, 28, 29 }, + { 36, 37, 38, 45, 46, NO_LED }, + { 6, 7, 8, 9, 10, 11 }, + { 18, 19, 20, 21, 22, 23 }, + { 30, 31, 32, 33, 34, 35 }, + { 42, 43, 44, 39, 40, 41 } +}, { + { 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 }, + { 0, 21 }, { 20, 21 }, { 40, 21 }, { 61, 21 }, { 81, 21 }, { 101, 21 }, { 122, 21 }, { 142, 21 }, { 162, 21 }, { 183, 21 }, { 203, 21 }, { 223, 21 }, + { 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 }, + { 0, 63 }, { 20, 63 }, { 40, 63 }, { 61, 63 }, { 81, 63 }, { 111, 63 }, { 142, 63 }, { 162, 63 }, { 183, 63 }, { 203, 63 }, { 223, 63 } +}, { + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1 +} }; + void matrix_init_kb(void) { matrix_init_user(); diff --git a/keyboards/planck/keymaps/tom/keymap.c b/keyboards/planck/keymaps/tom/keymap.c index 5b7177c6c9..0ffff4e695 100644 --- a/keyboards/planck/keymaps/tom/keymap.c +++ b/keyboards/planck/keymaps/tom/keymap.c @@ -224,14 +224,16 @@ bool music_mask_user(uint16_t keycode) { } } +#ifdef RGB_MATRIX_ENABLE +extern led_config_t g_led_config; +#endif + void rgb_matrix_indicators_user(void) { #ifdef RGB_MATRIX_ENABLE - rgb_led led; switch (biton32(layer_state)) { case _RAISE: 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, 0x6B, 0x00, 0x80); } else { rgb_matrix_set_color(i, 0x00, 0xFF, 0x00); @@ -241,8 +243,7 @@ void rgb_matrix_indicators_user(void) { case _LOWER: 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, 0xFF, 0xA5, 0x00); } else { rgb_matrix_set_color(i, 0x00, 0x67, 0xC7); diff --git a/keyboards/planck/light/light.c b/keyboards/planck/light/light.c index 178d28274c..896ec44587 100644 --- a/keyboards/planck/light/light.c +++ b/keyboards/planck/light/light.c @@ -77,65 +77,24 @@ const is31_led g_is31_leds[DRIVER_LED_TOTAL] = { {1, C9_14, C8_14, C7_14} }; -rgb_led g_rgb_leds[DRIVER_LED_TOTAL] = { - - /*{row | col << 4} - | {x=0..224, y=0..64} - | | flags - | | | */ - {{0|(0<<4)}, {20.36*0, 21.33*0}, 1}, - {{0|(1<<4)}, {20.36*1, 21.33*0}, 4}, - {{0|(2<<4)}, {20.36*2, 21.33*0}, 4}, - {{0|(3<<4)}, {20.36*3, 21.33*0}, 4}, - {{0|(4<<4)}, {20.36*4, 21.33*0}, 4}, - {{0|(5<<4)}, {20.36*5, 21.33*0}, 4}, - {{0|(6<<4)}, {20.36*6, 21.33*0}, 4}, - {{0|(7<<4)}, {20.36*7, 21.33*0}, 4}, - {{0|(8<<4)}, {20.36*8, 21.33*0}, 4}, - {{0|(9<<4)}, {20.36*9, 21.33*0}, 4}, - {{0|(10<<4)}, {20.36*10,21.33*0}, 4}, - {{0|(11<<4)}, {20.36*11,21.33*0}, 1}, - - {{1|(0<<4)}, {20.36*0, 21.33*1}, 1}, - {{1|(1<<4)}, {20.36*1, 21.33*1}, 4}, - {{1|(2<<4)}, {20.36*2, 21.33*1}, 4}, - {{1|(3<<4)}, {20.36*3, 21.33*1}, 4}, - {{1|(4<<4)}, {20.36*4, 21.33*1}, 4}, - {{1|(5<<4)}, {20.36*5, 21.33*1}, 4}, - {{1|(6<<4)}, {20.36*6, 21.33*1}, 4}, - {{1|(7<<4)}, {20.36*7, 21.33*1}, 4}, - {{1|(8<<4)}, {20.36*8, 21.33*1}, 4}, - {{1|(9<<4)}, {20.36*9, 21.33*1}, 4}, - {{1|(10<<4)}, {20.36*10,21.33*1}, 4}, - {{1|(11<<4)}, {20.36*11,21.33*1}, 1}, - - {{2|(0<<4)}, {20.36*0, 21.33*2}, 1}, - {{2|(1<<4)}, {20.36*1, 21.33*2}, 4}, - {{2|(2<<4)}, {20.36*2, 21.33*2}, 4}, - {{2|(3<<4)}, {20.36*3, 21.33*2}, 4}, - {{2|(4<<4)}, {20.36*4, 21.33*2}, 4}, - {{2|(5<<4)}, {20.36*5, 21.33*2}, 4}, - {{2|(6<<4)}, {20.36*6, 21.33*2}, 4}, - {{2|(7<<4)}, {20.36*7, 21.33*2}, 4}, - {{2|(8<<4)}, {20.36*8, 21.33*2}, 4}, - {{2|(9<<4)}, {20.36*9, 21.33*2}, 4}, - {{2|(10<<4)}, {20.36*10,21.33*2}, 4}, - {{2|(11<<4)}, {20.36*11,21.33*2}, 1}, - - {{3|(0<<4)}, {20.36*0, 21.33*3}, 1}, - {{3|(1<<4)}, {20.36*1, 21.33*3}, 1}, - {{3|(2<<4)}, {20.36*2, 21.33*3}, 1}, - {{3|(3<<4)}, {20.36*3, 21.33*3}, 1}, - {{3|(4<<4)}, {20.36*4, 21.33*3}, 1}, - {{3|(5<<4)}, {20.36*5, 21.33*3}, 4}, - {{3|(5<<4)}, {20.36*5.5,21.33*3}, 4}, - {{3|(6<<4)}, {20.36*6, 21.33*3}, 4}, - {{3|(7<<4)}, {20.36*7, 21.33*3}, 1}, - {{3|(8<<4)}, {20.36*8, 21.33*3}, 1}, - {{3|(9<<4)}, {20.36*9, 21.33*3}, 1}, - {{3|(10<<4)}, {20.36*10,21.33*3}, 1}, - {{3|(11<<4)}, {20.36*11,21.33*3}, 1} -}; +led_config_t g_led_config = { { + { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 }, + { 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23 }, + { 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35 }, + { 36, 37, 38, 39, 40, 41, 43, 44, 45, 46, 47, 48 } +}, { + { 0, 0 }, { 20, 0 }, { 40, 0 }, { 61, 0 }, { 81, 0 }, { 101, 0 }, { 122, 0 }, { 142, 0 }, { 162, 0 }, { 183, 0 }, { 203, 0 }, { 223, 0 }, + { 0, 21 }, { 20, 21 }, { 40, 21 }, { 61, 21 }, { 81, 21 }, { 101, 21 }, { 122, 21 }, { 142, 21 }, { 162, 21 }, { 183, 21 }, { 203, 21 }, { 223, 21 }, + { 0, 42 }, { 20, 42 }, { 40, 42 }, { 61, 42 }, { 81, 42 }, { 101, 42 }, { 122, 42 }, { 142, 42 }, { 162, 42 }, { 183, 42 }, { 203, 42 }, { 223, 42 }, + { 0, 63 }, { 20, 63 }, { 40, 63 }, { 61, 63 }, { 81, 63 }, { 101, 63 }, { 111, 63 }, { 122, 63 }, { 142, 63 }, { 162, 63 }, { 183, 63 }, { 203, 63 }, + { 223, 63 } +}, { + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 1, + 1, 1, 1, 1, 1, 4, 4, 4, 1, 1, 1, 1, + 1 +} }; void matrix_init_kb(void) { @@ -151,6 +110,16 @@ bool process_record_kb(uint16_t keycode, keyrecord_t *record) return process_record_user(keycode, record); } +uint8_t rgb_matrix_map_row_column_to_led_kb(uint8_t row, uint8_t column, uint8_t *led_i) { + // Spacebar has 2 leds 41 & 42, so add 42 to the array here, and 41 will be added + // by the default lookup code that runs after this + if (row == 3 && column == 5) { + led_i[0] = 42; + return 1; + } + return 0; +} + void matrix_scan_kb(void) { matrix_scan_user(); |