From e617fd6f3dbdfccd208288c65bfc9a4b63034c62 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Fri, 3 Jan 2020 07:03:38 +0900 Subject: [PATCH 1/5] Moved contents of rgblight_reconfig.h to rgblight_post_config.h. In #3582, rgblight_reconfig.h had to be newly created. Now, the build system of qmk_firmware has a post_cofig feature, so that what was done in rgblight_reconfig.h can now be realized in rgblight_post_config.h. **This commit does not change the build result.** Testing script ```shell # build on master git checkout master echo master > /tmp/master_md5.txt # RGBLIGHT_ENABLE = no make HELIX=verbose helix/rev2:default:clean make HELIX=verbose helix/rev2:default md5 helix_rev2_default.hex >> /tmp/master_md5.txt # RGBLIGHT_ENABLE = yes, with animations make HELIX=verbose helix/rev2/back:default:clean make HELIX=verbose helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt # RGBLIGHT_ENABLE = yes, without animations make HELIX=verbose,no_ani helix/rev2/back:default:clean make HELIX=verbose,no_ani helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/master_md5.txt # build on refactor_rgblight_reconfig.h git checkout refactor_rgblight_reconfig.h echo refactor_rgblight_reconfig.h > /tmp/branch_md5.txt # RGBLIGHT_ENABLE = no make HELIX=verbose helix/rev2:default:clean make HELIX=verbose helix/rev2:default md5 helix_rev2_default.hex >> /tmp/branch_md5.txt # RGBLIGHT_ENABLE = yes, with animations make HELIX=verbose helix/rev2/back:default:clean make HELIX=verbose helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt # RGBLIGHT_ENABLE = yes, without animations make HELIX=verbose,no_ani helix/rev2/back:default:clean make HELIX=verbose,no_ani helix/rev2/back:default md5 helix_rev2_back_default.hex >> /tmp/branch_md5.txt diff -u /tmp/master_md5.txt /tmp/branch_md5.txt ``` Test result: ``` --- /tmp/master_md5.txt 2020-01-03 15:42:22.000000000 +0900 +++ /tmp/branch_md5.txt 2020-01-03 15:42:42.000000000 +0900 @@ -1,4 +1,4 @@ -master +refactor_rgblight_reconfig.h MD5 (helix_rev2_default.hex) = f360032edd522448366d471d8f4f8181 MD5 (helix_rev2_back_default.hex) = 0c663acc6cccc44476b3b969ad22a48f MD5 (helix_rev2_back_default.hex) = e66b1195ff6d38e6e22c975b8ae42fd3 ``` --- quantum/rgblight.h | 2 -- quantum/rgblight_post_config.h | 25 +++++++++++++++++++++++++ quantum/rgblight_reconfig.h | 29 ----------------------------- tmk_core/common/avr/suspend.c | 1 - tmk_core/protocol/chibios/main.c | 1 - tmk_core/protocol/lufa/lufa.c | 1 - tmk_core/protocol/vusb/main.c | 1 - 7 files changed, 25 insertions(+), 35 deletions(-) delete mode 100644 quantum/rgblight_reconfig.h diff --git a/quantum/rgblight.h b/quantum/rgblight.h index c0fc0f3c636c..ff186d2fbb99 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -16,8 +16,6 @@ #ifndef RGBLIGHT_H #define RGBLIGHT_H -#include "rgblight_reconfig.h" - /***** rgblight_mode(mode)/rgblight_mode_noeeprom(mode) **** old mode number (before 0.6.117) to new mode name table diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h index 3c14cb6109f7..ca525b9c8ac9 100644 --- a/quantum/rgblight_post_config.h +++ b/quantum/rgblight_post_config.h @@ -3,3 +3,28 @@ // it is considered that RGBLIGHT_SPLIT is defined implicitly. # define RGBLIGHT_SPLIT #endif + +#ifdef RGBLIGHT_ANIMATIONS +// for backward compatibility +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_RGB_TEST +# define RGBLIGHT_EFFECT_ALTERNATING +#endif + +#ifdef RGBLIGHT_STATIC_PATTERNS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +#endif + +// check dynamic animation effects chose ? +#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) || defined(RGBLIGHT_EFFECT_CHRISTMAS) || defined(RGBLIGHT_EFFECT_RGB_TEST) || defined(RGBLIGHT_EFFECT_ALTERNATING) +# define RGBLIGHT_USE_TIMER +# ifndef RGBLIGHT_ANIMATIONS +# define RGBLIGHT_ANIMATIONS // for backward compatibility +# endif +#endif diff --git a/quantum/rgblight_reconfig.h b/quantum/rgblight_reconfig.h deleted file mode 100644 index 4b9d6c4c2f42..000000000000 --- a/quantum/rgblight_reconfig.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef RGBLIGHT_RECONFIG_H -#define RGBLIGHT_RECONFIG_H - -#ifdef RGBLIGHT_ANIMATIONS -// for backward compatibility -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL -# define RGBLIGHT_EFFECT_SNAKE -# define RGBLIGHT_EFFECT_KNIGHT -# define RGBLIGHT_EFFECT_CHRISTMAS -# define RGBLIGHT_EFFECT_STATIC_GRADIENT -# define RGBLIGHT_EFFECT_RGB_TEST -# define RGBLIGHT_EFFECT_ALTERNATING -#endif - -#ifdef RGBLIGHT_STATIC_PATTERNS -# define RGBLIGHT_EFFECT_STATIC_GRADIENT -#endif - -// check dynamic animation effects chose ? -#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) || defined(RGBLIGHT_EFFECT_CHRISTMAS) || defined(RGBLIGHT_EFFECT_RGB_TEST) || defined(RGBLIGHT_EFFECT_ALTERNATING) -# define RGBLIGHT_USE_TIMER -# ifndef RGBLIGHT_ANIMATIONS -# define RGBLIGHT_ANIMATIONS // for backward compatibility -# endif -#endif - -#endif // RGBLIGHT_RECONFIG_H diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index c59c19688005..afcca0ad9ece 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -9,7 +9,6 @@ #include "timer.h" #include "led.h" #include "host.h" -#include "rgblight_reconfig.h" #ifdef PROTOCOL_LUFA # include "lufa.h" diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 4b66bc5224b6..3658d19fa060 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -32,7 +32,6 @@ #include "sendchar.h" #include "debug.h" #include "printf.h" -#include "rgblight_reconfig.h" #if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) # include "rgblight.h" diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 7d325a9ba2bc..279ed8cfab71 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -54,7 +54,6 @@ #include "quantum.h" #include #include "outputselect.h" -#include "rgblight_reconfig.h" #ifdef NKRO_ENABLE # include "keycode_config.h" diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c index 06dc8ae67fee..463485b25ffd 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c @@ -20,7 +20,6 @@ #include "timer.h" #include "uart.h" #include "debug.h" -#include "rgblight_reconfig.h" #if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) # include "rgblight.h" From 1d6b01f7b3d2975bd7c02d2753f864c2a4e811ca Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Sat, 4 Jan 2020 14:44:20 +0900 Subject: [PATCH 2/5] Expressions that are too long are difficult to read, so wrap them. --- quantum/rgblight_post_config.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h index ca525b9c8ac9..51d3cc7e7c64 100644 --- a/quantum/rgblight_post_config.h +++ b/quantum/rgblight_post_config.h @@ -21,8 +21,17 @@ # define RGBLIGHT_EFFECT_STATIC_GRADIENT #endif +// clang-format off + // check dynamic animation effects chose ? -#if defined(RGBLIGHT_EFFECT_BREATHING) || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || defined(RGBLIGHT_EFFECT_SNAKE) || defined(RGBLIGHT_EFFECT_KNIGHT) || defined(RGBLIGHT_EFFECT_CHRISTMAS) || defined(RGBLIGHT_EFFECT_RGB_TEST) || defined(RGBLIGHT_EFFECT_ALTERNATING) +#if defined(RGBLIGHT_EFFECT_BREATHING) || \ + defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || \ + defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || \ + defined(RGBLIGHT_EFFECT_SNAKE) || \ + defined(RGBLIGHT_EFFECT_KNIGHT) || \ + defined(RGBLIGHT_EFFECT_CHRISTMAS) || \ + defined(RGBLIGHT_EFFECT_RGB_TEST) || \ + defined(RGBLIGHT_EFFECT_ALTERNATING) # define RGBLIGHT_USE_TIMER # ifndef RGBLIGHT_ANIMATIONS # define RGBLIGHT_ANIMATIONS // for backward compatibility From 757af486e45c7205c0efc6f50f6a631125ffb90e Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Sat, 4 Jan 2020 14:50:27 +0900 Subject: [PATCH 3/5] Edit the expression again --- quantum/rgblight_post_config.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h index 51d3cc7e7c64..bb4c95d05514 100644 --- a/quantum/rgblight_post_config.h +++ b/quantum/rgblight_post_config.h @@ -24,14 +24,14 @@ // clang-format off // check dynamic animation effects chose ? -#if defined(RGBLIGHT_EFFECT_BREATHING) || \ - defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) || \ - defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) || \ - defined(RGBLIGHT_EFFECT_SNAKE) || \ - defined(RGBLIGHT_EFFECT_KNIGHT) || \ - defined(RGBLIGHT_EFFECT_CHRISTMAS) || \ - defined(RGBLIGHT_EFFECT_RGB_TEST) || \ - defined(RGBLIGHT_EFFECT_ALTERNATING) +#if defined(RGBLIGHT_EFFECT_BREATHING) \ + || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) \ + || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) \ + || defined(RGBLIGHT_EFFECT_SNAKE) \ + || defined(RGBLIGHT_EFFECT_KNIGHT) \ + || defined(RGBLIGHT_EFFECT_CHRISTMAS) \ + || defined(RGBLIGHT_EFFECT_RGB_TEST) \ + || defined(RGBLIGHT_EFFECT_ALTERNATING) # define RGBLIGHT_USE_TIMER # ifndef RGBLIGHT_ANIMATIONS # define RGBLIGHT_ANIMATIONS // for backward compatibility From 693bd87eb4fd97104e9b026f4eb9a95e8c607a35 Mon Sep 17 00:00:00 2001 From: mtei <2170248+mtei@users.noreply.github.com> Date: Sun, 5 Jan 2020 16:11:16 +0900 Subject: [PATCH 4/5] remove `defined(RGBLIGHT_ANIMATIONS)` in `tmk_core/common/*/suspend.c`, `tmk_core/protocol/*/main.c` move contents of rgblight_reconfig.h to rgblight.h. The following changes were made to rgblight.h. ```diff +#ifdef RGBLIGHT_USE_TIMER void rgblight_task(void); void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); +#else +#define rgblight_task() +#define rgblight_timer_init() +#define rgblight_timer_enable() +#define rgblight_timer_disable() +#define rgblight_timer_toggle() +#endif ``` The following changes were made to tmk_core/common/avr/suspend.c, tmk_core/common/chibios/suspend.c, tmk_core/protocol/chibios/main.c, tmk_core/protocol/lufa/lufa.c, tmk_core/protocol/vusb/main.c. ```diff -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); -# endif ``` ```diff -#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) rgblight_task(); #endif ``` --- quantum/rgblight.c | 12 --------- quantum/rgblight.h | 42 ++++++++++++++++++++++++++++++- quantum/rgblight_post_config.h | 34 ------------------------- tmk_core/common/avr/suspend.c | 21 ---------------- tmk_core/common/avr/suspend_avr.h | 33 ++++++++++++------------ tmk_core/common/chibios/suspend.c | 4 --- tmk_core/protocol/chibios/main.c | 2 +- tmk_core/protocol/lufa/lufa.c | 2 +- tmk_core/protocol/vusb/main.c | 2 +- 9 files changed, 61 insertions(+), 91 deletions(-) diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 40de19eac31d..d7ab70190deb 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -209,9 +209,7 @@ void rgblight_init(void) { eeconfig_debug_rgblight(); // display current eeprom values -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_init(); // setup the timer -#endif if (rgblight_config.enable) { rgblight_mode_noeeprom(rgblight_config.mode); @@ -228,9 +226,7 @@ void rgblight_update_dword(uint32_t dword) { if (rgblight_config.enable) rgblight_mode_noeeprom(rgblight_config.mode); else { -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); -#endif rgblight_set(); } } @@ -298,13 +294,9 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom) { dprintf("rgblight mode [NOEEPROM]: %u\n", rgblight_config.mode); } if (is_static_effect(rgblight_config.mode)) { -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); -#endif } else { -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_enable(); -#endif } #ifdef RGBLIGHT_USE_TIMER animation_status.restart = true; @@ -352,9 +344,7 @@ void rgblight_disable(void) { rgblight_config.enable = 0; eeconfig_update_rgblight(rgblight_config.raw); dprintf("rgblight disable [EEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); -#endif RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); @@ -363,9 +353,7 @@ void rgblight_disable(void) { void rgblight_disable_noeeprom(void) { rgblight_config.enable = 0; dprintf("rgblight disable [NOEEPROM]: rgblight_config.enable = %u\n", rgblight_config.enable); -#ifdef RGBLIGHT_USE_TIMER rgblight_timer_disable(); -#endif RGBLIGHT_SPLIT_SET_CHANGE_MODE; wait_ms(50); rgblight_set(); diff --git a/quantum/rgblight.h b/quantum/rgblight.h index ff186d2fbb99..39c4c2784fc7 100644 --- a/quantum/rgblight.h +++ b/quantum/rgblight.h @@ -62,6 +62,39 @@ |-----------------|-----------------------------------| *****/ +#ifdef RGBLIGHT_ANIMATIONS +// for backward compatibility +# define RGBLIGHT_EFFECT_BREATHING +# define RGBLIGHT_EFFECT_RAINBOW_MOOD +# define RGBLIGHT_EFFECT_RAINBOW_SWIRL +# define RGBLIGHT_EFFECT_SNAKE +# define RGBLIGHT_EFFECT_KNIGHT +# define RGBLIGHT_EFFECT_CHRISTMAS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +# define RGBLIGHT_EFFECT_RGB_TEST +# define RGBLIGHT_EFFECT_ALTERNATING +#endif + +#ifdef RGBLIGHT_STATIC_PATTERNS +# define RGBLIGHT_EFFECT_STATIC_GRADIENT +#endif + +// clang-format off + +// check dynamic animation effects chose ? +#if defined(RGBLIGHT_EFFECT_BREATHING) \ + || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) \ + || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) \ + || defined(RGBLIGHT_EFFECT_SNAKE) \ + || defined(RGBLIGHT_EFFECT_KNIGHT) \ + || defined(RGBLIGHT_EFFECT_CHRISTMAS) \ + || defined(RGBLIGHT_EFFECT_RGB_TEST) \ + || defined(RGBLIGHT_EFFECT_ALTERNATING) +# define RGBLIGHT_USE_TIMER +#endif + +// clang-format on + #define _RGBM_SINGLE_STATIC(sym) RGBLIGHT_MODE_##sym, #define _RGBM_SINGLE_DYNAMIC(sym) RGBLIGHT_MODE_##sym, #define _RGBM_MULTI_STATIC(sym) RGBLIGHT_MODE_##sym, @@ -261,12 +294,19 @@ void rgblight_mode_eeprom_helper(uint8_t mode, bool write_to_eeprom); # define EZ_RGB(val) rgblight_show_solid_color((val >> 16) & 0xFF, (val >> 8) & 0xFF, val & 0xFF) void rgblight_show_solid_color(uint8_t r, uint8_t g, uint8_t b); +#ifdef RGBLIGHT_USE_TIMER void rgblight_task(void); - void rgblight_timer_init(void); void rgblight_timer_enable(void); void rgblight_timer_disable(void); void rgblight_timer_toggle(void); +#else +#define rgblight_task() +#define rgblight_timer_init() +#define rgblight_timer_enable() +#define rgblight_timer_disable() +#define rgblight_timer_toggle() +#endif # ifdef RGBLIGHT_SPLIT # define RGBLIGHT_STATUS_CHANGE_MODE (1 << 0) diff --git a/quantum/rgblight_post_config.h b/quantum/rgblight_post_config.h index bb4c95d05514..3c14cb6109f7 100644 --- a/quantum/rgblight_post_config.h +++ b/quantum/rgblight_post_config.h @@ -3,37 +3,3 @@ // it is considered that RGBLIGHT_SPLIT is defined implicitly. # define RGBLIGHT_SPLIT #endif - -#ifdef RGBLIGHT_ANIMATIONS -// for backward compatibility -# define RGBLIGHT_EFFECT_BREATHING -# define RGBLIGHT_EFFECT_RAINBOW_MOOD -# define RGBLIGHT_EFFECT_RAINBOW_SWIRL -# define RGBLIGHT_EFFECT_SNAKE -# define RGBLIGHT_EFFECT_KNIGHT -# define RGBLIGHT_EFFECT_CHRISTMAS -# define RGBLIGHT_EFFECT_STATIC_GRADIENT -# define RGBLIGHT_EFFECT_RGB_TEST -# define RGBLIGHT_EFFECT_ALTERNATING -#endif - -#ifdef RGBLIGHT_STATIC_PATTERNS -# define RGBLIGHT_EFFECT_STATIC_GRADIENT -#endif - -// clang-format off - -// check dynamic animation effects chose ? -#if defined(RGBLIGHT_EFFECT_BREATHING) \ - || defined(RGBLIGHT_EFFECT_RAINBOW_MOOD) \ - || defined(RGBLIGHT_EFFECT_RAINBOW_SWIRL) \ - || defined(RGBLIGHT_EFFECT_SNAKE) \ - || defined(RGBLIGHT_EFFECT_KNIGHT) \ - || defined(RGBLIGHT_EFFECT_CHRISTMAS) \ - || defined(RGBLIGHT_EFFECT_RGB_TEST) \ - || defined(RGBLIGHT_EFFECT_ALTERNATING) -# define RGBLIGHT_USE_TIMER -# ifndef RGBLIGHT_ANIMATIONS -# define RGBLIGHT_ANIMATIONS // for backward compatibility -# endif -#endif diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c index afcca0ad9ece..11ac146eb80e 100644 --- a/tmk_core/common/avr/suspend.c +++ b/tmk_core/common/avr/suspend.c @@ -29,23 +29,6 @@ static bool rgblight_enabled; static bool is_suspended; #endif -#define wdt_intr_enable(value) \ - __asm__ __volatile__("in __tmp_reg__,__SREG__" \ - "\n\t" \ - "cli" \ - "\n\t" \ - "wdr" \ - "\n\t" \ - "sts %0,%1" \ - "\n\t" \ - "out __SREG__,__tmp_reg__" \ - "\n\t" \ - "sts %0,%2" \ - "\n\t" \ - : /* no outputs */ \ - : "M"(_SFR_MEM_ADDR(_WD_CONTROL_REG)), "r"(_BV(_WD_CHANGE_BIT) | _BV(WDE)), "r"((uint8_t)((value & 0x08 ? _WD_PS3_MASK : 0x00) | _BV(WDIE) | (value & 0x07))) \ - : "r0") - /** \brief Suspend idle * * FIXME: needs doc @@ -121,9 +104,7 @@ static void power_down(uint8_t wdto) { // stop_all_notes(); # endif /* AUDIO_ENABLE */ # if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); -# endif if (!is_suspended) { is_suspended = true; rgblight_enabled = rgblight_config.enable; @@ -203,9 +184,7 @@ void suspend_wakeup_init(void) { # endif rgblight_enable_noeeprom(); } -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); -# endif #endif suspend_wakeup_init_kb(); } diff --git a/tmk_core/common/avr/suspend_avr.h b/tmk_core/common/avr/suspend_avr.h index d73852ba11c2..e4cc0be50543 100644 --- a/tmk_core/common/avr/suspend_avr.h +++ b/tmk_core/common/avr/suspend_avr.h @@ -7,21 +7,22 @@ #include #include -#define wdt_intr_enable(value) \ - __asm__ __volatile__("in __tmp_reg__,__SREG__" \ - "\n\t" \ - "cli" \ - "\n\t" \ - "wdr" \ - "\n\t" \ - "sts %0,%1" \ - "\n\t" \ - "out __SREG__,__tmp_reg__" \ - "\n\t" \ - "sts %0,%2" \ - "\n\t" \ - : /* no outputs */ \ - : "M"(_SFR_MEM_ADDR(_WD_CONTROL_REG)), "r"(_BV(_WD_CHANGE_BIT) | _BV(WDE)), "r"((uint8_t)((value & 0x08 ? _WD_PS3_MASK : 0x00) | _BV(WDIE) | (value & 0x07))) \ - : "r0") +// clang-format off +#define wdt_intr_enable(value) \ +__asm__ __volatile__ ( \ + "in __tmp_reg__,__SREG__" "\n\t" \ + "cli" "\n\t" \ + "wdr" "\n\t" \ + "sts %0,%1" "\n\t" \ + "out __SREG__,__tmp_reg__" "\n\t" \ + "sts %0,%2" "\n\t" \ + : /* no outputs */ \ + : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \ + "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \ + "r" ((uint8_t) ((value & 0x08 ? _WD_PS3_MASK : 0x00) | \ + _BV(WDIE) | (value & 0x07)) ) \ + : "r0" \ +) +// clang-format on #endif diff --git a/tmk_core/common/chibios/suspend.c b/tmk_core/common/chibios/suspend.c index 5be1b767779a..8c071e7a086d 100644 --- a/tmk_core/common/chibios/suspend.c +++ b/tmk_core/common/chibios/suspend.c @@ -51,9 +51,7 @@ void suspend_power_down(void) { // shouldn't power down TPM/FTM if we want a breathing LED // also shouldn't power down USB #if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_disable(); -# endif if (!is_suspended) { is_suspended = true; rgblight_enabled = rgblight_config.enable; @@ -126,9 +124,7 @@ void suspend_wakeup_init(void) { if (rgblight_enabled) { rgblight_enable_noeeprom(); } -# ifdef RGBLIGHT_ANIMATIONS rgblight_timer_enable(); -# endif #endif suspend_wakeup_init_kb(); } diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index 3658d19fa060..4006043174fe 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -33,7 +33,7 @@ #include "debug.h" #include "printf.h" -#if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) # include "rgblight.h" #endif #ifdef SLEEP_LED_ENABLE diff --git a/tmk_core/protocol/lufa/lufa.c b/tmk_core/protocol/lufa/lufa.c index 279ed8cfab71..eda1ec683037 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -77,7 +77,7 @@ extern keymap_config_t keymap_config; # include "virtser.h" #endif -#if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) # include "rgblight.h" #endif diff --git a/tmk_core/protocol/vusb/main.c b/tmk_core/protocol/vusb/main.c index 463485b25ffd..e825b3508f11 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c @@ -21,7 +21,7 @@ #include "uart.h" #include "debug.h" -#if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) # include "rgblight.h" #endif From 5a458802743a75e9c753eb3c8c907eba1d1097a0 Mon Sep 17 00:00:00 2001 From: Joel Challis Date: Sun, 19 Jan 2020 00:59:09 +0000 Subject: [PATCH 5/5] remove 'defined(RGBLIGHT_ANIMATIONS)' in tmk_core/common/keyboard.c --- tmk_core/common/keyboard.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tmk_core/common/keyboard.c b/tmk_core/common/keyboard.c index cb4e7637fa1a..a767d9c8773e 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -335,7 +335,7 @@ void keyboard_task(void) { matrix_scan_perf_task(); #endif -#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) rgblight_task(); #endif