From a2e5e9b97882c8e5f31016bd404b4af5686752f7 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Wed, 13 Mar 2019 05:29:32 +0900 Subject: [PATCH] cherry-pick from 'rgblight_modes.h sample implementation' --- quantum/rgblight.c | 4 +-- quantum/rgblight.h | 70 +--------------------------------------- quantum/rgblight_modes.h | 67 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 71 deletions(-) create mode 100644 quantum/rgblight_modes.h diff --git a/quantum/rgblight.c b/quantum/rgblight.c index d8cfcf86be..ad076cd42b 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -59,7 +59,7 @@ #define _RGBM_TMP_STATIC(sym, msym) RGBLIGHT_MODE_ ## sym, #define _RGBM_TMP_DYNAMIC(sym, msym) static uint8_t static_effect_table [] = { -#include "rgblight.h" +#include "rgblight_modes.h" }; #define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_ ## sym, @@ -70,7 +70,7 @@ static uint8_t static_effect_table [] = { #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## msym, static uint8_t mode_base_table [] = { 0, // RGBLIGHT_MODE_zero -#include "rgblight.h" +#include "rgblight_modes.h" }; static inline int is_static_effect(uint8_t mode) { diff --git a/quantum/rgblight.h b/quantum/rgblight.h index bd0d21e1d1..aeff2cb1d7 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -72,7 +72,7 @@ #define _RGBM_TMP_DYNAMIC(sym, msym) RGBLIGHT_MODE_ ## sym, enum RGBLIGHT_EFFECT_MODE { RGBLIGHT_MODE_zero = 0, -#include "rgblight.h" +#include "rgblight_modes.h" RGBLIGHT_MODE_last }; @@ -288,71 +288,3 @@ void rgblight_effect_alternating(animation_status_t *anim); #endif // #ifndef RGBLIGHT_H_DUMMY_DEFINE #endif // RGBLIGHT_H - -#ifdef _RGBM_SINGLE_STATIC - _RGBM_SINGLE_STATIC( STATIC_LIGHT ) - #ifdef RGBLIGHT_EFFECT_BREATHING - _RGBM_MULTI_DYNAMIC( BREATHING ) - _RGBM_TMP_DYNAMIC( breathing_3, BREATHING ) - _RGBM_TMP_DYNAMIC( breathing_4, BREATHING ) - _RGBM_TMP_DYNAMIC( BREATHING_end, BREATHING ) - #endif - #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD - _RGBM_MULTI_DYNAMIC( RAINBOW_MOOD ) - _RGBM_TMP_DYNAMIC( rainbow_mood_7, RAINBOW_MOOD ) - _RGBM_TMP_DYNAMIC( RAINBOW_MOOD_end, RAINBOW_MOOD ) - #endif - #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL - _RGBM_MULTI_DYNAMIC( RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_10, RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_11, RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_12, RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( rainbow_swirl_13, RAINBOW_SWIRL ) - _RGBM_TMP_DYNAMIC( RAINBOW_SWIRL_end, RAINBOW_SWIRL ) - #endif - #ifdef RGBLIGHT_EFFECT_SNAKE - _RGBM_MULTI_DYNAMIC( SNAKE ) - _RGBM_TMP_DYNAMIC( snake_16, SNAKE ) - _RGBM_TMP_DYNAMIC( snake_17, SNAKE ) - _RGBM_TMP_DYNAMIC( snake_18, SNAKE ) - _RGBM_TMP_DYNAMIC( snake_19, SNAKE ) - _RGBM_TMP_DYNAMIC( SNAKE_end, SNAKE ) - #endif - #ifdef RGBLIGHT_EFFECT_KNIGHT - _RGBM_MULTI_DYNAMIC( KNIGHT ) - _RGBM_TMP_DYNAMIC( knight_22, KNIGHT ) - _RGBM_TMP_DYNAMIC( KNIGHT_end, KNIGHT ) - #endif - #ifdef RGBLIGHT_EFFECT_CHRISTMAS - _RGBM_SINGLE_DYNAMIC( CHRISTMAS ) - #endif - #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT - _RGBM_MULTI_STATIC( STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_26, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_27, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_28, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_29, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_30, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_31, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_32, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( static_gradient_33, STATIC_GRADIENT ) - _RGBM_TMP_STATIC( STATIC_GRADIENT_end, STATIC_GRADIENT ) - #endif - #ifdef RGBLIGHT_EFFECT_RGB_TEST - _RGBM_SINGLE_DYNAMIC( RGB_TEST ) - #endif - #ifdef RGBLIGHT_EFFECT_ALTERNATING - _RGBM_SINGLE_DYNAMIC( ALTERNATING ) - #endif - //// Add a new mode here. - // #ifdef RGBLIGHT_EFFECT_ - // _RGBM__( ) - // #endif -#endif - -#undef _RGBM_SINGLE_STATIC -#undef _RGBM_SINGLE_DYNAMIC -#undef _RGBM_MULTI_STATIC -#undef _RGBM_MULTI_DYNAMIC -#undef _RGBM_TMP_STATIC -#undef _RGBM_TMP_DYNAMIC diff --git a/quantum/rgblight_modes.h b/quantum/rgblight_modes.h new file mode 100644 index 0000000000..8a8f9bdda9 --- /dev/null +++ b/quantum/rgblight_modes.h @@ -0,0 +1,67 @@ +#ifdef _RGBM_SINGLE_STATIC + _RGBM_SINGLE_STATIC( STATIC_LIGHT ) + #ifdef RGBLIGHT_EFFECT_BREATHING + _RGBM_MULTI_DYNAMIC( BREATHING ) + _RGBM_TMP_DYNAMIC( breathing_3, BREATHING ) + _RGBM_TMP_DYNAMIC( breathing_4, BREATHING ) + _RGBM_TMP_DYNAMIC( BREATHING_end, BREATHING ) + #endif + #ifdef RGBLIGHT_EFFECT_RAINBOW_MOOD + _RGBM_MULTI_DYNAMIC( RAINBOW_MOOD ) + _RGBM_TMP_DYNAMIC( rainbow_mood_7, RAINBOW_MOOD ) + _RGBM_TMP_DYNAMIC( RAINBOW_MOOD_end, RAINBOW_MOOD ) + #endif + #ifdef RGBLIGHT_EFFECT_RAINBOW_SWIRL + _RGBM_MULTI_DYNAMIC( RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_10, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_11, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_12, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( rainbow_swirl_13, RAINBOW_SWIRL ) + _RGBM_TMP_DYNAMIC( RAINBOW_SWIRL_end, RAINBOW_SWIRL ) + #endif + #ifdef RGBLIGHT_EFFECT_SNAKE + _RGBM_MULTI_DYNAMIC( SNAKE ) + _RGBM_TMP_DYNAMIC( snake_16, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_17, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_18, SNAKE ) + _RGBM_TMP_DYNAMIC( snake_19, SNAKE ) + _RGBM_TMP_DYNAMIC( SNAKE_end, SNAKE ) + #endif + #ifdef RGBLIGHT_EFFECT_KNIGHT + _RGBM_MULTI_DYNAMIC( KNIGHT ) + _RGBM_TMP_DYNAMIC( knight_22, KNIGHT ) + _RGBM_TMP_DYNAMIC( KNIGHT_end, KNIGHT ) + #endif + #ifdef RGBLIGHT_EFFECT_CHRISTMAS + _RGBM_SINGLE_DYNAMIC( CHRISTMAS ) + #endif + #ifdef RGBLIGHT_EFFECT_STATIC_GRADIENT + _RGBM_MULTI_STATIC( STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_26, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_27, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_28, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_29, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_30, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_31, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_32, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( static_gradient_33, STATIC_GRADIENT ) + _RGBM_TMP_STATIC( STATIC_GRADIENT_end, STATIC_GRADIENT ) + #endif + #ifdef RGBLIGHT_EFFECT_RGB_TEST + _RGBM_SINGLE_DYNAMIC( RGB_TEST ) + #endif + #ifdef RGBLIGHT_EFFECT_ALTERNATING + _RGBM_SINGLE_DYNAMIC( ALTERNATING ) + #endif + //// Add a new mode here. + // #ifdef RGBLIGHT_EFFECT_ + // _RGBM__( ) + // #endif +#endif + +#undef _RGBM_SINGLE_STATIC +#undef _RGBM_SINGLE_DYNAMIC +#undef _RGBM_MULTI_STATIC +#undef _RGBM_MULTI_DYNAMIC +#undef _RGBM_TMP_STATIC +#undef _RGBM_TMP_DYNAMIC