From 6689f900fc0ed9022706af7605d40225a3348f63 Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Mon, 13 May 2019 14:48:53 -0700 Subject: Consolidate RGB Matrix layer indication function And changes to iris --- layouts/community/ortho_4x12/drashna/keymap.c | 30 ++++++++++----------------- 1 file changed, 11 insertions(+), 19 deletions(-) (limited to 'layouts/community/ortho_4x12/drashna/keymap.c') diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 9b0c2d7949..3ebcd84a69 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -180,14 +180,6 @@ void suspend_wakeup_init_keymap(void) { rgb_matrix_set_suspend_state(false); } -void rgb_matrix_layer_helper (uint8_t red, uint8_t green, uint8_t blue) { - 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_mod = get_mods(); uint8_t this_led = host_keyboard_leds(); @@ -209,29 +201,29 @@ void rgb_matrix_indicators_user(void) { ) { switch (biton32(layer_state)) { case _RAISE: - rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break; case _LOWER: - rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break; case _ADJUST: - rgb_matrix_layer_helper(0xFF, 0x00, 0x00); break; + rgb_matrix_layer_helper(0xFF, 0x00, 0x00, LED_FLAG_MODIFIER); break; default: switch (biton32(default_layer_state)) { case _QWERTY: - rgb_matrix_layer_helper(0x00, 0xFF, 0xFF); break; + rgb_matrix_layer_helper(0x00, 0xFF, 0xFF, LED_FLAG_MODIFIER); break; case _COLEMAK: - rgb_matrix_layer_helper(0xFF, 0x00, 0xFF); break; + rgb_matrix_layer_helper(0xFF, 0x00, 0xFF, LED_FLAG_MODIFIER); break; case _DVORAK: - rgb_matrix_layer_helper(0x00, 0xFF, 0x00); break; + rgb_matrix_layer_helper(0x00, 0xFF, 0x00, LED_FLAG_MODIFIER); break; case _WORKMAN: - rgb_matrix_layer_helper(0xD9, 0xA5, 0x21); break; + rgb_matrix_layer_helper(0xD9, 0xA5, 0x21, LED_FLAG_MODIFIER); break; case _NORMAN: - rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D); break; + rgb_matrix_layer_helper(0xFF, 0x7C, 0x4D, LED_FLAG_MODIFIER); break; case _MALTRON: - rgb_matrix_layer_helper(0xFF, 0xFF, 0x00); break; + rgb_matrix_layer_helper(0xFF, 0xFF, 0x00, LED_FLAG_MODIFIER); break; case _EUCALYN: - rgb_matrix_layer_helper(0xFF, 0x80, 0xBF); break; + rgb_matrix_layer_helper(0xFF, 0x80, 0xBF, LED_FLAG_MODIFIER); break; case _CARPLAX: - rgb_matrix_layer_helper(0x00, 0x00, 0xFF); break; + rgb_matrix_layer_helper(0x00, 0x00, 0xFF, LED_FLAG_MODIFIER); break; } } } -- cgit v1.2.3 From 89e9785d7a87e8dbb941dd272c032f34658169fd Mon Sep 17 00:00:00 2001 From: Drashna Jaelre Date: Fri, 17 May 2019 15:21:45 -0700 Subject: Update my code to use layer_state_t typedef --- layouts/community/ortho_4x12/drashna/keymap.c | 2 +- users/drashna/drashna.c | 8 ++++---- users/drashna/drashna.h | 4 ++-- users/drashna/rgb_stuff.c | 2 +- users/drashna/rgb_stuff.h | 4 ++-- users/drashna/template.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) (limited to 'layouts/community/ortho_4x12/drashna/keymap.c') diff --git a/layouts/community/ortho_4x12/drashna/keymap.c b/layouts/community/ortho_4x12/drashna/keymap.c index 3ebcd84a69..c1c016ce9f 100644 --- a/layouts/community/ortho_4x12/drashna/keymap.c +++ b/layouts/community/ortho_4x12/drashna/keymap.c @@ -319,7 +319,7 @@ void dip_update(uint8_t index, bool active) { #endif // KEYBOARD_planck_rev6 #ifdef KEYBOARD_planck_ez -uint32_t layer_state_set_keymap(uint32_t state) { +layer_state_t layer_state_set_keymap(layer_state_t state) { palClearPad(GPIOB, 8); palClearPad(GPIOB, 9); diff --git a/users/drashna/drashna.c b/users/drashna/drashna.c index 7c60a2e4a5..acc6b9f9ed 100644 --- a/users/drashna/drashna.c +++ b/users/drashna/drashna.c @@ -187,13 +187,13 @@ void matrix_scan_user(void) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } // on layer change, no matter where the change was initiated // Then runs keymap's layer change check -uint32_t layer_state_set_user(uint32_t state) { +layer_state_t layer_state_set_user(layer_state_t state) { state = update_tri_layer_state(state, _RAISE, _LOWER, _ADJUST); #ifdef RGBLIGHT_ENABLE state = layer_state_set_rgb(state); @@ -203,12 +203,12 @@ uint32_t layer_state_set_user(uint32_t state) { __attribute__ ((weak)) -uint32_t default_layer_state_set_keymap (uint32_t state) { +layer_state_t default_layer_state_set_keymap (layer_state_t state) { return state; } // Runs state check and changes underglow color and animation -uint32_t default_layer_state_set_user(uint32_t state) { +layer_state_t default_layer_state_set_user(layer_state_t state) { state = default_layer_state_set_keymap(state); #if 0 #ifdef RGBLIGHT_ENABLE diff --git a/users/drashna/drashna.h b/users/drashna/drashna.h index 5df67792a5..507504f04e 100644 --- a/users/drashna/drashna.h +++ b/users/drashna/drashna.h @@ -67,8 +67,8 @@ void shutdown_keymap(void); void suspend_power_down_keymap(void); void suspend_wakeup_init_keymap(void); void matrix_scan_keymap(void); -uint32_t layer_state_set_keymap (uint32_t state); -uint32_t default_layer_state_set_keymap (uint32_t state); +layer_state_t layer_state_set_keymap (layer_state_t state); +layer_state_t default_layer_state_set_keymap (layer_state_t state); void led_set_keymap(uint8_t usb_led); void eeconfig_init_keymap(void); diff --git a/users/drashna/rgb_stuff.c b/users/drashna/rgb_stuff.c index 3421866170..7d364fa686 100644 --- a/users/drashna/rgb_stuff.c +++ b/users/drashna/rgb_stuff.c @@ -275,7 +275,7 @@ void matrix_scan_rgb(void) { } -uint32_t layer_state_set_rgb(uint32_t state) { +layer_state_t layer_state_set_rgb(layer_state_t state) { #ifdef RGBLIGHT_ENABLE if (userspace_config.rgb_layer_change) { switch (biton32(state)) { diff --git a/users/drashna/rgb_stuff.h b/users/drashna/rgb_stuff.h index 5721046127..f5bbd0f3b5 100644 --- a/users/drashna/rgb_stuff.h +++ b/users/drashna/rgb_stuff.h @@ -15,8 +15,8 @@ bool process_record_user_rgb(uint16_t keycode, keyrecord_t *record); void scan_rgblight_fadeout(void); void keyboard_post_init_rgb(void); void matrix_scan_rgb(void); -uint32_t layer_state_set_rgb(uint32_t state); -uint32_t default_layer_state_set_rgb(uint32_t state); +layer_state_t layer_state_set_rgb(layer_state_t state); +layer_state_t default_layer_state_set_rgb(layer_state_t state); void rgblight_sethsv_default_helper(uint8_t index); void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ); diff --git a/users/drashna/template.c b/users/drashna/template.c index 0e188f3a5e..d90e6bdecf 100644 --- a/users/drashna/template.c +++ b/users/drashna/template.c @@ -62,11 +62,11 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { __attribute__ ((weak)) -uint32_t layer_state_set_keymap (uint32_t state) { +layer_state_t layer_state_set_keymap (layer_state_t state) { return state; } -uint32_t layer_state_set_user (uint32_t state) { +layer_state_t layer_state_set_user (layer_state_t state) { return layer_state_set_keymap (state); } -- cgit v1.2.3