From af89752bffbaf5dcea30ea16be66b4d682701bc4 Mon Sep 17 00:00:00 2001 From: XScorpion2 Date: Tue, 7 May 2019 18:22:46 -0500 Subject: 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 --- keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c | 30 ++++++++++------------ 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c') diff --git a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c index 3dfa78374..a6d1e226b 100644 --- a/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c +++ b/keyboards/dztech/dz60rgb/keymaps/mekanist/keymap.c @@ -50,40 +50,36 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { -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)) { - rgb_matrix_set_color( i, red, green, blue ); - } - } +extern led_config_t g_led_config; +void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue, bool default_layer) { + for (int i = 0; i < DRIVER_LED_TOTAL; i++) { + if (HAS_FLAGS(g_led_config.flags[i], LED_FLAG_MODIFIER)) { + rgb_matrix_set_color( i, red, green, blue ); + } + } } void rgb_matrix_indicators_user(void) { uint8_t this_led = host_keyboard_leds(); - + if (!g_suspend_state) { switch (biton32(layer_state)) { case _LAYER1: rgb_matrix_layer_helper(0xFF, 0x00, 0x00, false); break; - + case _LAYER2: rgb_matrix_layer_helper(0x00, 0xFF, 0x00, false); break; - + case _LAYER4: rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, false); break; } } - + if (this_led & (1 << USB_LED_CAPS_LOCK)) { rgb_matrix_set_color(40, 0xFF, 0xFF, 0xFF); } - + switch (biton32(layer_state)) { case _LAYER3: if (this_led & (1 << USB_LED_NUM_LOCK)) { @@ -91,7 +87,7 @@ void rgb_matrix_indicators_user(void) } else { rgb_matrix_set_color(13, 0x00, 0x00, 0x00); } - + rgb_matrix_set_color(0, 0x00, 0xFF, 0x00); rgb_matrix_set_color(1, 0x00, 0x00, 0x00); rgb_matrix_set_color(1, 0x00, 0xFF, 0x00); -- cgit v1.2.3