From 346b06d391dbc760d753a5cffcbbcb58ecc9ce95 Mon Sep 17 00:00:00 2001 From: Less/Rikki <86894501+lesshonor@users.noreply.github.com> Date: Thu, 28 Sep 2023 06:51:18 -0400 Subject: refactor: move default RGB/LED matrix #defines (#21938) * refactor: move default RGB/LED matrix #defines Moving the fallback definitions of macros like LED_MATRIX_VAL_STEP and RGB_MATRIX_MAXIMUM_BRIGHTNESS to header files allows keyboards to leverage these defaults without requiring #ifdef guards (and often repeating said fallback definitions). * style: use if(n)def for consistency and remove redundant UINT8_MAX checks on maximum brightness Co-authored-by: Joel Challis * refactor: remove INDICATOR_MAX_BRIGHTNESS macro Co-authored-by: Joel Challis --------- Co-authored-by: Joel Challis --- keyboards/teleport/native/ansi/keymaps/default/keymap.c | 6 +++--- keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c | 6 +++--- keyboards/teleport/native/ansi/keymaps/via/keymap.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'keyboards/teleport/native/ansi') diff --git a/keyboards/teleport/native/ansi/keymaps/default/keymap.c b/keyboards/teleport/native/ansi/keymaps/default/keymap.c index fcea5c41f3..2780fdda7d 100644 --- a/keyboards/teleport/native/ansi/keymaps/default/keymap.c +++ b/keyboards/teleport/native/ansi/keymaps/default/keymap.c @@ -53,11 +53,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* RGB matrix indicator code It reads the current matrix color, offsets the hue by 30, -and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +and sets val to RGB_MATRIX_MAXIMUM_BRIGHTNESS (by default, 255) This is applied to both caps lock, and other indicator keys for layer 1 */ bool rgb_matrix_indicators_user(void) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. @@ -70,7 +70,7 @@ bool rgb_matrix_indicators_user(void) { /* Sets W, A, S, D, LGUI to a different color as layer indicator */ if(IS_LAYER_ON(1)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); diff --git a/keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c b/keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c index 1a7852a062..ab598dd5e6 100644 --- a/keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c +++ b/keyboards/teleport/native/ansi/keymaps/perfmode/keymap.c @@ -144,13 +144,13 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* RGB matrix indicator code It reads the current matrix color, offsets the hue by 30, -and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +and sets val to RGB_MATRIX_MAXIMUM_BRIGHTNESS (by default, 255) This is applied to both caps lock, and other indicator keys for layer 1 */ bool rgb_matrix_indicators_user(void) { /* Layer 2 (perf mode on this keymap) is not supposed to have LED refreshes, hence excluded */ if (!IS_LAYER_ON(2)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. @@ -163,7 +163,7 @@ bool rgb_matrix_indicators_user(void) { /* Sets W, A, S, D, LGUI to a different color as layer indicator */ if(IS_LAYER_ON(1)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); diff --git a/keyboards/teleport/native/ansi/keymaps/via/keymap.c b/keyboards/teleport/native/ansi/keymaps/via/keymap.c index e1fbd285ec..95a5bc58b1 100644 --- a/keyboards/teleport/native/ansi/keymaps/via/keymap.c +++ b/keyboards/teleport/native/ansi/keymaps/via/keymap.c @@ -53,11 +53,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { /* RGB matrix indicator code It reads the current matrix color, offsets the hue by 30, -and sets val to either 255 or, if defined, RGB_MATRIX_MAXIMUM_BRIGHTNESS +and sets val to RGB_MATRIX_MAXIMUM_BRIGHTNESS (by default, 255) This is applied to both caps lock, and other indicator keys for layer 1 */ bool rgb_matrix_indicators_user(void) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); /* Sets Caps to different color as indicator. If RGB mode is rain, and caps indicator is off, the LED will always be off. @@ -70,7 +70,7 @@ bool rgb_matrix_indicators_user(void) { /* Sets W, A, S, D, LGUI to a different color as layer indicator */ if(IS_LAYER_ON(1)) { - HSV hsv_ind = {rgb_matrix_get_hue()+30,255,INDICATOR_MAX_BRIGHTNESS}; + HSV hsv_ind = {rgb_matrix_get_hue()+30,255,RGB_MATRIX_MAXIMUM_BRIGHTNESS}; RGB rgb_ind = hsv_to_rgb(hsv_ind); rgb_matrix_set_color(W_LED_INDEX, rgb_ind.r, rgb_ind.g, rgb_ind.b); -- cgit v1.2.3