mirror of
https://github.com/qmk/qmk_userspace.git
synced 2025-05-10 01:24:18 -04:00
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 <git@zvecr.com> * refactor: remove INDICATOR_MAX_BRIGHTNESS macro Co-authored-by: Joel Challis <git@zvecr.com> --------- Co-authored-by: Joel Challis <git@zvecr.com>
This commit is contained in:
parent
f00ff55232
commit
9d76cda686
3 changed files with 8 additions and 12 deletions
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -73,15 +73,11 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
|||
// Code for Caps Locks indicator
|
||||
#if defined(RGB_MATRIX_ENABLE) && defined(CAPS_LOCK_LED_INDEX)
|
||||
|
||||
#define CAPS_LOCK_MAX_BRIGHTNESS 0xFF
|
||||
#ifdef RGB_MATRIX_MAXIMUM_BRIGHTNESS
|
||||
#undef CAPS_LOCK_MAX_BRIGHTNESS
|
||||
#if !defined(CAPS_LOCK_MAX_BRIGHTNESS)
|
||||
#define CAPS_LOCK_MAX_BRIGHTNESS RGB_MATRIX_MAXIMUM_BRIGHTNESS
|
||||
#endif
|
||||
|
||||
#define CAPS_LOCK_VAL_STEP 8
|
||||
#ifdef RGB_MATRIX_VAL_STEP
|
||||
#undef CAPS_LOCK_VAL_STEP
|
||||
#if !defined(CAPS_LOCK_VAL_STEP)
|
||||
#define CAPS_LOCK_VAL_STEP RGB_MATRIX_VAL_STEP
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue