aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/feature_rgb_matrix.md16
-rw-r--r--docs/feature_rgblight.md14
-rw-r--r--quantum/rgb_matrix.c11
-rw-r--r--quantum/rgb_matrix.h13
-rw-r--r--quantum/rgblight.c6
-rw-r--r--quantum/rgblight.h2
6 files changed, 50 insertions, 12 deletions
diff --git a/docs/feature_rgb_matrix.md b/docs/feature_rgb_matrix.md
index 2cec55ee7..15057827c 100644
--- a/docs/feature_rgb_matrix.md
+++ b/docs/feature_rgb_matrix.md
@@ -437,12 +437,16 @@ Where `28` is an unused index from `eeconfig.h`.
437|`rgb_matrix_sethsv_noeeprom(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) | 437|`rgb_matrix_sethsv_noeeprom(h, s, v)` |Set LEDs to the given HSV value where `h`/`s`/`v` are between 0 and 255 (not written to EEPROM) |
438 438
439### Query Current Status :id=query-current-status 439### Query Current Status :id=query-current-status
440|Function |Description | 440|Function |Description |
441|-----------------------|-----------------| 441|---------------------------------|---------------------------|
442|`rgb_matrix_get_mode()` |Get current mode | 442|`rgb_matrix_is_enabled()` |Gets current on/off status |
443|`rgb_matrix_get_hue()` |Get current hue | 443|`rgb_matrix_get_mode()` |Gets current mode |
444|`rgb_matrix_get_sat()` |Get current sat | 444|`rgb_matrix_get_hue()` |Gets current hue |
445|`rgb_matrix_get_val()` |Get current val | 445|`rgb_matrix_get_sat()` |Gets current sat |
446|`rgb_matrix_get_val()` |Gets current val |
447|`rgb_matrix_get_hsv()` |Gets hue, sat, and val and returns a [`HSV` structure](https://github.com/qmk/qmk_firmware/blob/7ba6456c0b2e041bb9f97dbed265c5b8b4b12192/quantum/color.h#L56-L61)|
448|`rgb_matrix_get_speed()` |Gets current speed |
449|`rgb_matrix_get_suspend_state()` |Gets current suspend state |
446 450
447## Callbacks :id=callbacks 451## Callbacks :id=callbacks
448 452
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index 7e54bfef3..7f5c8a36c 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -376,12 +376,14 @@ rgblight_sethsv(HSV_GREEN, 2); // led 2
376|`rgblight_set_layer_state(i, is_on)` |Enable or disable lighting layer `i` based on value of `bool is_on` | 376|`rgblight_set_layer_state(i, is_on)` |Enable or disable lighting layer `i` based on value of `bool is_on` |
377 377
378#### query 378#### query
379|Function |Description | 379|Function |Description |
380|-----------------------|-----------------| 380|-----------------------|---------------------------|
381|`rgblight_get_mode()` |Get current mode | 381|`rgblight_is_enabled()`|Gets current on/off status |
382|`rgblight_get_hue()` |Get current hue | 382|`rgblight_get_mode()` |Gets current mode |
383|`rgblight_get_sat()` |Get current sat | 383|`rgblight_get_hue()` |Gets current hue |
384|`rgblight_get_val()` |Get current val | 384|`rgblight_get_sat()` |Gets current sat |
385|`rgblight_get_val()` |Gets current val |
386|`rgblight_get_speed()` |Gets current speed |
385 387
386## Colors 388## Colors
387 389
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 3fae9d737..91032b656 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -440,6 +440,8 @@ void rgb_matrix_set_suspend_state(bool state) {
440 g_suspend_state = state; 440 g_suspend_state = state;
441} 441}
442 442
443bool rgb_matrix_get_suspend_state(void) { return g_suspend_state; }
444
443void rgb_matrix_toggle(void) { 445void rgb_matrix_toggle(void) {
444 rgb_matrix_config.enable ^= 1; 446 rgb_matrix_config.enable ^= 1;
445 rgb_task_state = STARTING; 447 rgb_task_state = STARTING;
@@ -466,6 +468,8 @@ void rgb_matrix_disable_noeeprom(void) {
466 rgb_matrix_config.enable = 0; 468 rgb_matrix_config.enable = 0;
467} 469}
468 470
471uint8_t rgb_matrix_is_enabled(void) { return rgb_matrix_config.enable; }
472
469void rgb_matrix_step(void) { 473void rgb_matrix_step(void) {
470 rgb_matrix_config.mode++; 474 rgb_matrix_config.mode++;
471 if (rgb_matrix_config.mode >= RGB_MATRIX_EFFECT_MAX) rgb_matrix_config.mode = 1; 475 if (rgb_matrix_config.mode >= RGB_MATRIX_EFFECT_MAX) rgb_matrix_config.mode = 1;
@@ -521,6 +525,8 @@ void rgb_matrix_decrease_speed(void) {
521 eeconfig_update_rgb_matrix(); 525 eeconfig_update_rgb_matrix();
522} 526}
523 527
528uint8_t rgb_matrix_get_speed(void) { return rgb_matrix_config.speed; }
529
524led_flags_t rgb_matrix_get_flags(void) { return rgb_effect_params.flags; } 530led_flags_t rgb_matrix_get_flags(void) { return rgb_effect_params.flags; }
525 531
526void rgb_matrix_set_flags(led_flags_t flags) { rgb_effect_params.flags = flags; } 532void rgb_matrix_set_flags(led_flags_t flags) { rgb_effect_params.flags = flags; }
@@ -546,3 +552,8 @@ void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val) {
546 rgb_matrix_config.hsv.v = val; 552 rgb_matrix_config.hsv.v = val;
547 if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS; 553 if (rgb_matrix_config.hsv.v > RGB_MATRIX_MAXIMUM_BRIGHTNESS) rgb_matrix_config.hsv.v = RGB_MATRIX_MAXIMUM_BRIGHTNESS;
548} 554}
555
556HSV rgb_matrix_get_hsv(void) { return rgb_matrix_config.hsv; }
557uint8_t rgb_matrix_get_hue(void) { return rgb_matrix_config.hsv.h; }
558uint8_t rgb_matrix_get_sat(void) { return rgb_matrix_config.hsv.s; }
559uint8_t rgb_matrix_get_val(void) { return rgb_matrix_config.hsv.v; }
diff --git a/quantum/rgb_matrix.h b/quantum/rgb_matrix.h
index 96494836e..7c37311b4 100644
--- a/quantum/rgb_matrix.h
+++ b/quantum/rgb_matrix.h
@@ -104,11 +104,13 @@ void rgb_matrix_indicators_user(void);
104void rgb_matrix_init(void); 104void rgb_matrix_init(void);
105 105
106void rgb_matrix_set_suspend_state(bool state); 106void rgb_matrix_set_suspend_state(bool state);
107bool rgb_matrix_get_suspend_state(void);
107void rgb_matrix_toggle(void); 108void rgb_matrix_toggle(void);
108void rgb_matrix_enable(void); 109void rgb_matrix_enable(void);
109void rgb_matrix_enable_noeeprom(void); 110void rgb_matrix_enable_noeeprom(void);
110void rgb_matrix_disable(void); 111void rgb_matrix_disable(void);
111void rgb_matrix_disable_noeeprom(void); 112void rgb_matrix_disable_noeeprom(void);
113uint8_t rgb_matrix_is_enabled(void);
112void rgb_matrix_step(void); 114void rgb_matrix_step(void);
113void rgb_matrix_step_reverse(void); 115void rgb_matrix_step_reverse(void);
114void rgb_matrix_increase_hue(void); 116void rgb_matrix_increase_hue(void);
@@ -119,6 +121,7 @@ void rgb_matrix_increase_val(void);
119void rgb_matrix_decrease_val(void); 121void rgb_matrix_decrease_val(void);
120void rgb_matrix_increase_speed(void); 122void rgb_matrix_increase_speed(void);
121void rgb_matrix_decrease_speed(void); 123void rgb_matrix_decrease_speed(void);
124uint8_t rgb_matrix_get_speed(void);
122led_flags_t rgb_matrix_get_flags(void); 125led_flags_t rgb_matrix_get_flags(void);
123void rgb_matrix_set_flags(led_flags_t flags); 126void rgb_matrix_set_flags(led_flags_t flags);
124void rgb_matrix_mode(uint8_t mode); 127void rgb_matrix_mode(uint8_t mode);
@@ -126,6 +129,10 @@ void rgb_matrix_mode_noeeprom(uint8_t mode);
126uint8_t rgb_matrix_get_mode(void); 129uint8_t rgb_matrix_get_mode(void);
127void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val); 130void rgb_matrix_sethsv(uint16_t hue, uint8_t sat, uint8_t val);
128void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val); 131void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
132HSV rgb_matrix_get_hsv(void);
133uint8_t rgb_matrix_get_hue(void);
134uint8_t rgb_matrix_get_sat(void);
135uint8_t rgb_matrix_get_val(void);
129 136
130#ifndef RGBLIGHT_ENABLE 137#ifndef RGBLIGHT_ENABLE
131# define rgblight_toggle rgb_matrix_toggle 138# define rgblight_toggle rgb_matrix_toggle
@@ -133,6 +140,7 @@ void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
133# define rgblight_enable_noeeprom rgb_matrix_enable_noeeprom 140# define rgblight_enable_noeeprom rgb_matrix_enable_noeeprom
134# define rgblight_disable rgb_matrix_disable 141# define rgblight_disable rgb_matrix_disable
135# define rgblight_disable_noeeprom rgb_matrix_disable_noeeprom 142# define rgblight_disable_noeeprom rgb_matrix_disable_noeeprom
143# define rgblight_is_enabled rgb_matrix_is_enabled
136# define rgblight_step rgb_matrix_step 144# define rgblight_step rgb_matrix_step
137# define rgblight_sethsv rgb_matrix_sethsv 145# define rgblight_sethsv rgb_matrix_sethsv
138# define rgblight_sethsv_noeeprom rgb_matrix_sethsv_noeeprom 146# define rgblight_sethsv_noeeprom rgb_matrix_sethsv_noeeprom
@@ -145,9 +153,14 @@ void rgb_matrix_sethsv_noeeprom(uint16_t hue, uint8_t sat, uint8_t val);
145# define rgblight_decrease_val rgb_matrix_decrease_val 153# define rgblight_decrease_val rgb_matrix_decrease_val
146# define rgblight_increase_speed rgb_matrix_increase_speed 154# define rgblight_increase_speed rgb_matrix_increase_speed
147# define rgblight_decrease_speed rgb_matrix_decrease_speed 155# define rgblight_decrease_speed rgb_matrix_decrease_speed
156# define rgblight_get_speed rgb_matrix_get_speed
148# define rgblight_mode rgb_matrix_mode 157# define rgblight_mode rgb_matrix_mode
149# define rgblight_mode_noeeprom rgb_matrix_mode_noeeprom 158# define rgblight_mode_noeeprom rgb_matrix_mode_noeeprom
150# define rgblight_get_mode rgb_matrix_get_mode 159# define rgblight_get_mode rgb_matrix_get_mode
160# define rgblight_get_hue rgb_matrix_get_hue
161# define rgblight_get_sat rgb_matrix_get_sat
162# define rgblight_get_val rgb_matrix_get_val
163# define rgblight_get_hsv rgb_matrix_get_hsv
151#endif 164#endif
152 165
153typedef struct { 166typedef struct {
diff --git a/quantum/rgblight.c b/quantum/rgblight.c
index 64123774c..b50be200e 100644
--- a/quantum/rgblight.c
+++ b/quantum/rgblight.c
@@ -368,6 +368,8 @@ void rgblight_disable_noeeprom(void) {
368 rgblight_set(); 368 rgblight_set();
369} 369}
370 370
371bool rgblight_is_enabled(void) { return rgblight_config.enable; }
372
371void rgblight_increase_hue_helper(bool write_to_eeprom) { 373void rgblight_increase_hue_helper(bool write_to_eeprom) {
372 uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP; 374 uint8_t hue = rgblight_config.hue + RGBLIGHT_HUE_STEP;
373 rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom); 375 rgblight_sethsv_eeprom_helper(hue, rgblight_config.sat, rgblight_config.val, write_to_eeprom);
@@ -522,6 +524,10 @@ uint8_t rgblight_get_sat(void) { return rgblight_config.sat; }
522 524
523uint8_t rgblight_get_val(void) { return rgblight_config.val; } 525uint8_t rgblight_get_val(void) { return rgblight_config.val; }
524 526
527HSV rgblight_get_hsv(void) {
528 return (HSV){ rgblight_config.hue, rgblight_config.sat, rgblight_config.val };
529}
530
525void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) { 531void rgblight_setrgb(uint8_t r, uint8_t g, uint8_t b) {
526 if (!rgblight_config.enable) { 532 if (!rgblight_config.enable) {
527 return; 533 return;
diff --git a/quantum/rgblight.h b/quantum/rgblight.h
index 6fc3b6f17..c36b328a3 100644
--- a/quantum/rgblight.h
+++ b/quantum/rgblight.h
@@ -350,6 +350,8 @@ uint8_t rgblight_get_mode(void);
350uint8_t rgblight_get_hue(void); 350uint8_t rgblight_get_hue(void);
351uint8_t rgblight_get_sat(void); 351uint8_t rgblight_get_sat(void);
352uint8_t rgblight_get_val(void); 352uint8_t rgblight_get_val(void);
353bool rgblight_is_enabled(void);
354HSV rgblight_get_hsv(void);
353 355
354/* === qmk_firmware (core)internal Functions === */ 356/* === qmk_firmware (core)internal Functions === */
355void rgblight_init(void); 357void rgblight_init(void);