diff options
| author | Takeshi ISHII <2170248+mtei@users.noreply.github.com> | 2019-04-20 07:05:51 +0900 |
|---|---|---|
| committer | Drashna Jaelre <drashna@live.com> | 2019-04-19 15:05:51 -0700 |
| commit | dfab177f889fd6701e5f898c869be1bf3a2d0ef9 (patch) | |
| tree | 5dd9582cf5271389e931530bf2c8689299b8512d /quantum/rgblight.h | |
| parent | dd64a4e73868027b44a018278039cc42a01e730b (diff) | |
| download | qmk_firmware-dfab177f889fd6701e5f898c869be1bf3a2d0ef9.tar.gz qmk_firmware-dfab177f889fd6701e5f898c869be1bf3a2d0ef9.zip | |
Add function to support split-keyboard in rgblight.[ch]. (#5020)
* add temporary file that is rgblight.c call graph
* add rgblight_update_hook()
* update rgblight-call-graph.dot (temporary file)
* add more hook point
* add TODO comment
* temporary Revert "add TODO comment"
This reverts commit df6165aac9b3a31d1d3e31ce52aadc134b84eac2.
* temporary Revert "add more hook point"
This reverts commit 64592b06f3bcdaac47c59f922018a273bef76776.
* temporary Revert "add rgblight_update_hook()"
This reverts commit 432b74c912ed4333e6633e20a1bcda10c6a10eaf.
* add rgblight_update_hook()
* add more hook point
* add TODO comment
* implement rgblight_update_hook()
* remove rgblight_update_hook(), add RGBLIGHT_SPLIT_SET_CHANGE_XXXX
rgblight_update_hook() is too large.
change to simple flag setting.
* shrink rgblight_config_t
* implement rgblight_update_sync()
Note: The animation synchronization process has not been implemented yet.
* update quantum/rgblight-call-graph.dot (temporary file)
* rmove quantum/rgblight-call-graph.dot (temporary file)
* update rgblight.c
* Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c .
* fix build break rgblight_update_sync() when all animation off
* fix quantum/rgblight.c:rgblight_disable_XX() add RGBLIGHT_SPLIT_SET_CHANGE_MODE
* quantum/rgblight.c change code order: move rgblight_update_sync()
* add mode_base_table[] to quantum/rgblight.c
* quantum/rgblight.c use mode_base_table[] and rgblight_status.base_mode
* quantum/rgblkght.c animation timer integration
* quantum/rgblkght.c add animation sync for split keyboard
* fix mode_base_table[] and snake effect
* fix build break keyboards/mxss.
keyboards/mxss's local rgblight.c need old version rgblight.h
* rgblight.c: fix animation sync
* quantum/rgblight.c: fix snake effect sync
* quantum/rgblight.c: animation sync interverl 30 sec
* quantum/rgblight.c: fix rgblight_effect_rainbow_swirl() and rgblight_effect_knight()
* quantum/rgblight.c: add macro RGBLIGHT_SPLIT_ANIMATION
* cherry-pick from 'rgblight_modes.h sample implementation'
* fix RGBLIGHT_SPLIT_ANIMATION check position
* Update temporary code in Helix keyboard 'five_rows' keymap to test rgblight.c
* Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled.
* Changed to rgblight_sethsv_eeprom_helper() for easier reading.
* add fail-safe code to quantum/rgblight.c:rgblight_task(),rgblight_timer_enable()
* remove temporary code in Helix keyboard 'five_rows' keymap
* quantum/rgblight.c: add split-keyboard master side sync functions
add functions:
uint8_t rgblight_get_change_flags(void);
void rgblight_clear_change_flags(void);
void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo);
change function:
void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom);
* Change rgblight_update_sync() to use write_to_eeprom.
* remove TODO comment from quantum/rgblight.h
* Revert "fix build break keyboards/mxss."
This reverts commit 90b9a1aa7d8af226751500e49e3ea0214cc4e024.
(Separated this change into the newly opened PR #5461.)
* Revert "Reduce the firmware size by 1500 bytes when rgblight_effect_breathing() is enabled."
This reverts commit b61004e63e82cf5334cee4def4ba10cffa88885f.
* update quantum/rgblight.c: Code size reduction when not using RGBLIGHT_SPLIT.
* Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c .
* add temporary pdhelix(Patched Helix) code
* Add temporary code to split_common/transport.c to test rgblight.c.
* Finish testing rgblight.c with helix keyboard.
Revert "Add temporary code to Helix keyboard 'five_rows' keymap to test rgblight.c ."
This reverts commit 0bf81a4723a977adc0cb09b4272ee5c9b4f2bbbb.
* Finish testing rgblight.c with quantum/split_common code.
Revert "Add temporary code to split_common/transport.c to test rgblight.c."
This reverts commit 71db3e24eef40d4c455fb9fd1664e4487c9d927a.
* remove temporary pdhelix(Patched Helix) code
This reverts commit 5287e51a394741bcb6028c7cfc0dd0c984645f76.
* Added description of RGBLIGHT_SPLIT macro to docs/feature_rgblight.md.
* add RGBLIGHT_SPLIT_SET_CHANGE_HSVS to rgblight_init()
* Changed to restart animation only when changing mode.
When changing hue, sat and val, the animation is not restarted and continues.
Diffstat (limited to 'quantum/rgblight.h')
| -rw-r--r-- | quantum/rgblight.h | 134 |
1 files changed, 56 insertions, 78 deletions
diff --git a/quantum/rgblight.h b/quantum/rgblight.h index 1769f719d..748d009dc 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h | |||
| @@ -68,11 +68,11 @@ | |||
| 68 | #define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, | 68 | #define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, |
| 69 | #define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym, | 69 | #define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_ ## sym, |
| 70 | #define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, | 70 | #define _RGBM_MULTI_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, |
| 71 | #define _RGBM_TMP_STATIC(sym) RGBLIGHT_MODE_ ## sym, | 71 | #define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## sym, |
| 72 | #define _RGBM_TMP_DYNAMIC(sym) RGBLIGHT_MODE_ ## sym, | 72 | #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## sym, |
| 73 | enum RGBLIGHT_EFFECT_MODE { | 73 | enum RGBLIGHT_EFFECT_MODE { |
| 74 | RGBLIGHT_MODE_zero = 0, | 74 | RGBLIGHT_MODE_zero = 0, |
| 75 | #include "rgblight.h" | 75 | #include "rgblight_modes.h" |
| 76 | RGBLIGHT_MODE_last | 76 | RGBLIGHT_MODE_last |
| 77 | }; | 77 | }; |
| 78 | 78 | ||
| @@ -163,6 +163,33 @@ typedef union { | |||
| 163 | }; | 163 | }; |
| 164 | } rgblight_config_t; | 164 | } rgblight_config_t; |
| 165 | 165 | ||
| 166 | typedef struct _rgblight_status_t { | ||
| 167 | uint8_t base_mode; | ||
| 168 | bool timer_enabled; | ||
| 169 | #ifdef RGBLIGHT_SPLIT | ||
| 170 | uint8_t change_flags; | ||
| 171 | #endif | ||
| 172 | } rgblight_status_t; | ||
| 173 | |||
| 174 | #ifdef RGBLIGHT_SPLIT | ||
| 175 | #define RGBLIGHT_STATUS_CHANGE_MODE (1<<0) | ||
| 176 | #define RGBLIGHT_STATUS_CHANGE_HSVS (1<<1) | ||
| 177 | #define RGBLIGHT_STATUS_CHANGE_TIMER (1<<2) | ||
| 178 | #define RGBLIGHT_STATUS_ANIMATION_TICK (1<<3) | ||
| 179 | |||
| 180 | typedef struct _rgblight_syncinfo_t { | ||
| 181 | rgblight_config_t config; | ||
| 182 | rgblight_status_t status; | ||
| 183 | } rgblight_syncinfo_t; | ||
| 184 | |||
| 185 | /* for split keyboard master side */ | ||
| 186 | uint8_t rgblight_get_change_flags(void); | ||
| 187 | void rgblight_clear_change_flags(void); | ||
| 188 | void rgblight_get_syncinfo(rgblight_syncinfo_t *syncinfo); | ||
| 189 | /* for split keyboard slave side */ | ||
| 190 | void rgblight_update_sync(rgblight_syncinfo_t *syncinfo, bool write_to_eeprom); | ||
| 191 | #endif | ||
| 192 | |||
| 166 | void rgblight_init(void); | 193 | void rgblight_init(void); |
| 167 | void rgblight_increase(void); | 194 | void rgblight_increase(void); |
| 168 | void rgblight_decrease(void); | 195 | void rgblight_decrease(void); |
| @@ -237,82 +264,33 @@ void rgblight_timer_init(void); | |||
| 237 | void rgblight_timer_enable(void); | 264 | void rgblight_timer_enable(void); |
| 238 | void rgblight_timer_disable(void); | 265 | void rgblight_timer_disable(void); |
| 239 | void rgblight_timer_toggle(void); | 266 | void rgblight_timer_toggle(void); |
| 240 | void rgblight_effect_breathing(uint8_t interval); | ||
| 241 | void rgblight_effect_rainbow_mood(uint8_t interval); | ||
| 242 | void rgblight_effect_rainbow_swirl(uint8_t interval); | ||
| 243 | void rgblight_effect_snake(uint8_t interval); | ||
| 244 | void rgblight_effect_knight(uint8_t interval); | ||
| 245 | void rgblight_effect_christmas(void); | ||
| 246 | void rgblight_effect_rgbtest(void); | ||
| 247 | void rgblight_effect_alternating(void); | ||
| 248 | 267 | ||
| 249 | #endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE | 268 | #ifdef RGBLIGHT_USE_TIMER |
| 250 | #endif // RGBLIGHT_H | 269 | |
| 270 | typedef struct _animation_status_t { | ||
| 271 | uint16_t last_timer; | ||
| 272 | uint8_t delta; /* mode - base_mode */ | ||
| 273 | bool restart; | ||
| 274 | union { | ||
| 275 | uint16_t pos16; | ||
| 276 | uint8_t pos; | ||
| 277 | int16_t current_hue; | ||
| 278 | uint16_t current_offset; | ||
| 279 | }; | ||
| 280 | } animation_status_t; | ||
| 281 | |||
| 282 | extern animation_status_t animation_status; | ||
| 283 | |||
| 284 | void rgblight_effect_breathing(animation_status_t *anim); | ||
| 285 | void rgblight_effect_rainbow_mood(animation_status_t *anim); | ||
| 286 | void rgblight_effect_rainbow_swirl(animation_status_t *anim); | ||
| 287 | void rgblight_effect_snake(animation_status_t *anim); | ||
| 288 | void rgblight_effect_knight(animation_status_t *anim); | ||
| 289 | void rgblight_effect_christmas(animation_status_t *anim); | ||
| 290 | void rgblight_effect_rgbtest(animation_status_t *anim); | ||
| 291 | void rgblight_effect_alternating(animation_status_t *anim); | ||
| 251 | 292 | ||
| 252 | #ifdef _RGBM_SINGLE_STATIC | ||
| 253 | _RGBM_SINGLE_STATIC( STATIC_LIGHT ) | ||
| 254 | #ifdef RGBLIGHT_EFFECT_BREATHING | ||
| 255 | _RGBM_MULTI_DYNAMIC( BREATHING ) | ||
| 256 | _RGBM_TMP_DYNAMIC( breathing_3 ) | ||
| 257 | _RGBM_TMP_DYNAMIC( breathing_4 ) | ||
| 258 | _RGBM_TMP_DYNAMIC( BREATHING_end ) | ||
| 259 | #endif | ||
| 260 | #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD | ||
| 261 | _RGBM_MULTI_DYNAMIC( RAINBOW_MOOD ) | ||
| 262 | _RGBM_TMP_DYNAMIC( rainbow_mood_7 ) | ||
| 263 | _RGBM_TMP_DYNAMIC( RAINBOW_MOOD_end ) | ||
| 264 | #endif | ||
| 265 | #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL | ||
| 266 | _RGBM_MULTI_DYNAMIC( RAINBOW_SWIRL ) | ||
| 267 | _RGBM_TMP_DYNAMIC( rainbow_swirl_10 ) | ||
| 268 | _RGBM_TMP_DYNAMIC( rainbow_swirl_11 ) | ||
| 269 | _RGBM_TMP_DYNAMIC( rainbow_swirl_12 ) | ||
| 270 | _RGBM_TMP_DYNAMIC( rainbow_swirl_13 ) | ||
| 271 | _RGBM_TMP_DYNAMIC( RAINBOW_SWIRL_end ) | ||
| 272 | #endif | ||
| 273 | #ifdef RGBLIGHT_EFFECT_SNAKE | ||
| 274 | _RGBM_MULTI_DYNAMIC( SNAKE ) | ||
| 275 | _RGBM_TMP_DYNAMIC( snake_16 ) | ||
| 276 | _RGBM_TMP_DYNAMIC( snake_17 ) | ||
| 277 | _RGBM_TMP_DYNAMIC( snake_18 ) | ||
| 278 | _RGBM_TMP_DYNAMIC( snake_19 ) | ||
| 279 | _RGBM_TMP_DYNAMIC( SNAKE_end ) | ||
| 280 | #endif | ||
| 281 | #ifdef RGBLIGHT_EFFECT_KNIGHT | ||
| 282 | _RGBM_MULTI_DYNAMIC( KNIGHT ) | ||
| 283 | _RGBM_TMP_DYNAMIC( knight_22 ) | ||
| 284 | _RGBM_TMP_DYNAMIC( KNIGHT_end ) | ||
| 285 | #endif | ||
| 286 | #ifdef RGBLIGHT_EFFECT_CHRISTMAS | ||
| 287 | _RGBM_SINGLE_DYNAMIC( CHRISTMAS ) | ||
| 288 | #endif | ||
| 289 | #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT | ||
| 290 | _RGBM_MULTI_STATIC( STATIC_GRADIENT ) | ||
| 291 | _RGBM_TMP_STATIC( static_gradient_26 ) | ||
| 292 | _RGBM_TMP_STATIC( static_gradient_27 ) | ||
| 293 | _RGBM_TMP_STATIC( static_gradient_28 ) | ||
| 294 | _RGBM_TMP_STATIC( static_gradient_29 ) | ||
| 295 | _RGBM_TMP_STATIC( static_gradient_30 ) | ||
| 296 | _RGBM_TMP_STATIC( static_gradient_31 ) | ||
| 297 | _RGBM_TMP_STATIC( static_gradient_32 ) | ||
| 298 | _RGBM_TMP_STATIC( static_gradient_33 ) | ||
| 299 | _RGBM_TMP_STATIC( STATIC_GRADIENT_end ) | ||
| 300 | #endif | ||
| 301 | #ifdef RGBLIGHT_EFFECT_RGB_TEST | ||
| 302 | _RGBM_SINGLE_DYNAMIC( RGB_TEST ) | ||
| 303 | #endif | ||
| 304 | #ifdef RGBLIGHT_EFFECT_ALTERNATING | ||
| 305 | _RGBM_SINGLE_DYNAMIC( ALTERNATING ) | ||
| 306 | #endif | ||
| 307 | //// Add a new mode here. | ||
| 308 | // #ifdef RGBLIGHT_EFFECT_<name> | ||
| 309 | // _RGBM_<SINGLE|MULTI>_<STATIC|DYNAMIC>( <name> ) | ||
| 310 | // #endif | ||
| 311 | #endif | 293 | #endif |
| 312 | 294 | ||
| 313 | #undef _RGBM_SINGLE_STATIC | 295 | #endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE |
| 314 | #undef _RGBM_SINGLE_DYNAMIC | 296 | #endif // RGBLIGHT_H |
| 315 | #undef _RGBM_MULTI_STATIC | ||
| 316 | #undef _RGBM_MULTI_DYNAMIC | ||
| 317 | #undef _RGBM_TMP_STATIC | ||
| 318 | #undef _RGBM_TMP_DYNAMIC | ||
