From e1a9dfc5806d355225238324b17033d1da0ca8ea Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Thu, 28 Feb 2019 19:54:10 +0900 Subject: [PATCH] shrink rgblight_config_t --- quantum/rgblight.c | 6 +++--- quantum/rgblight.h | 16 +++++++++------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index e0bb0b8047..0c0797ebc8 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -157,9 +157,9 @@ void rgblight_check_config(void) { /* for split keyboard master side */ /* Overwrite with individual code of keyboard. */ -#define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_mode = 1 -#define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_hsvs = 1 -#define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_timer_enabled = 1 +#define RGBLIGHT_SPLIT_SET_CHANGE_MODE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_MODE +#define RGBLIGHT_SPLIT_SET_CHANGE_HSVS rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_HSVS +#define RGBLIGHT_SPLIT_SET_CHANGE_TIMER_ENABLE rgblight_status.change_flags |= RGBLIGHT_STATUS_CHANGE_TIMER /* for split keyboard slave side */ /* Call from keyboard individual code. */ diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 898071fbd2..5815999642 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -165,18 +165,20 @@ typedef union { typedef struct _rgblight_status_t { bool timer_enabled; - bool change_mode; // change mode or enable - bool change_hsvs; // change hue, sat, val or speed - bool change_timer_enabled; +#ifdef RGBLIGHT_SPLIT + uint8_t change_flags; // TODO: add animation syncronizing // (with integrate timer processing.) +#endif } rgblight_status_t; #ifdef RGBLIGHT_SPLIT -/* for split keyboard master side */ -void rgblight_update_hook(rgblight_config_t *config, rgblight_status_t *status, bool write_to_eeprom); -/* for split keyboard slave side */ -void rgblight_update_sync(rgblight_config_t *config, rgblight_status_t *status, bool write_to_eeprom); + #define RGBLIGHT_STATUS_CHANGE_MODE (1<<0) + #define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1) + #define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2) + + /* for split keyboard slave side */ + void rgblight_update_sync(rgblight_config_t *config, rgblight_status_t *status, bool write_to_eeprom); #endif void rgblight_init(void);