summaryrefslogtreecommitdiffstats
path: root/quantum/rgb_matrix.c
diff options
context:
space:
mode:
authorXScorpion2 <rcalt2vt@gmail.com>2019-04-30 00:18:50 +0200
committerMechMerlin <30334081+mechmerlin@users.noreply.github.com>2019-04-29 15:18:50 -0700
commita7113c8ed090d0ac647f30ee9b8ef41252e568ed (patch)
tree24d33db679b4d1357efef2784e69fea48e98d0ed /quantum/rgb_matrix.c
parent1d784f0f9575b70e35c9c8338b0ff80dc7316d7e (diff)
Updated rgb_led struct field modifier to flags (#5619)
Updated effects to test led flags Updated massdrop to use new flags field for led toggle
Diffstat (limited to 'quantum/rgb_matrix.c')
-rw-r--r--quantum/rgb_matrix.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/quantum/rgb_matrix.c b/quantum/rgb_matrix.c
index 5ca9b87a63..8c16c7790e 100644
--- a/quantum/rgb_matrix.c
+++ b/quantum/rgb_matrix.c
@@ -162,28 +162,11 @@ void rgb_matrix_update_pwm_buffers(void) {
}
void rgb_matrix_set_color( int index, uint8_t red, uint8_t green, uint8_t blue ) {
-#ifdef RGB_MATRIX_EXTRA_TOG
- const bool is_key = g_rgb_leds[index].matrix_co.raw != 0xff;
- if (
- (rgb_matrix_config.enable == RGB_ZONE_KEYS && !is_key) ||
- (rgb_matrix_config.enable == RGB_ZONE_UNDER && is_key)
- ) {
- rgb_matrix_driver.set_color(index, 0, 0, 0);
- return;
- }
-#endif
-
rgb_matrix_driver.set_color(index, red, green, blue);
}
void rgb_matrix_set_color_all( uint8_t red, uint8_t green, uint8_t blue ) {
-#ifdef RGB_MATRIX_EXTRA_TOG
- for (int i = 0; i < DRIVER_LED_TOTAL; i++) {
- rgb_matrix_set_color(i, red, green, blue);
- }
-#else
rgb_matrix_driver.set_color_all(red, green, blue);
-#endif
}
bool process_rgb_matrix(uint16_t keycode, keyrecord_t *record) {
@@ -262,7 +245,7 @@ static bool rgb_matrix_none(effect_params_t* params) {
static uint8_t rgb_last_enable = UINT8_MAX;
static uint8_t rgb_last_effect = UINT8_MAX;
-static effect_params_t rgb_effect_params = { 0, 0 };
+static effect_params_t rgb_effect_params = { 0, 0xFF };
static rgb_task_states rgb_task_state = SYNCING;
static void rgb_task_timers(void) {
@@ -575,29 +558,31 @@ void rgb_matrix_set_suspend_state(bool state) {
}
void rgb_matrix_toggle(void) {
- rgb_matrix_config.enable++;
- if (!rgb_matrix_config.enable) {
- rgb_task_state = STARTING;
- }
+ rgb_matrix_config.enable ^= 1;
+ rgb_task_state = STARTING;
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_enable(void) {
- rgb_matrix_config.enable = 1;
+ rgb_matrix_enable_noeeprom();
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_enable_noeeprom(void) {
- rgb_matrix_config.enable = 1;
+ if (!rgb_matrix_config.enable)
+ rgb_task_state = STARTING;
+ rgb_matrix_config.enable = 1;
}
void rgb_matrix_disable(void) {
- rgb_matrix_config.enable = 0;
+ rgb_matrix_disable_noeeprom();
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);
}
void rgb_matrix_disable_noeeprom(void) {
- rgb_matrix_config.enable = 0;
+ if (rgb_matrix_config.enable)
+ rgb_task_state = STARTING;
+ rgb_matrix_config.enable = 0;
}
void rgb_matrix_step(void) {
@@ -658,6 +643,14 @@ void rgb_matrix_decrease_speed(void) {
eeconfig_update_rgb_matrix(rgb_matrix_config.raw);//EECONFIG needs to be increased to support this
}
+led_flags_t rgb_matrix_get_flags(void) {
+ return rgb_effect_params.flags;
+}
+
+void rgb_matrix_set_flags(led_flags_t flags) {
+ rgb_effect_params.flags = flags;
+}
+
void rgb_matrix_mode(uint8_t mode) {
rgb_matrix_config.mode = mode;
rgb_task_state = STARTING;