diff options
-rw-r--r-- | quantum/rgblight.c | 12 | ||||
-rw-r--r-- | quantum/rgblight.h | 44 | ||||
-rw-r--r-- | quantum/rgblight_reconfig.h | 29 | ||||
-rw-r--r-- | tmk_core/common/avr/suspend.c | 22 | ||||
-rw-r--r-- | tmk_core/common/avr/suspend_avr.h | 33 | ||||
-rw-r--r-- | tmk_core/common/chibios/suspend.c | 4 | ||||
-rw-r--r-- | tmk_core/common/keyboard.c | 2 | ||||
-rw-r--r-- | tmk_core/protocol/chibios/main.c | 3 | ||||
-rw-r--r-- | tmk_core/protocol/lufa/lufa.c | 3 | ||||
-rw-r--r-- | tmk_core/protocol/vusb/main.c | 3 |
10 files changed, 62 insertions, 93 deletions
diff --git a/quantum/rgblight.c b/quantum/rgblight.c index 67d601af7..f072ae8ca 100644 --- a/quantum/rgblight.c +++ b/quantum/rgblight.c @@ -211,9 +211,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); @@ -230,9 +228,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(); } } @@ -300,13 +296,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; @@ -354,9 +346,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(); @@ -365,9 +355,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 c0fc0f3c6..39c4c2784 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 @@ -64,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, @@ -263,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_reconfig.h b/quantum/rgblight_reconfig.h deleted file mode 100644 index 4b9d6c4c2..000000000 --- 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 c59c19688..11ac146eb 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" @@ -30,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 @@ -122,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; @@ -204,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 d73852ba1..e4cc0be50 100644 --- a/tmk_core/common/avr/suspend_avr.h +++ b/tmk_core/common/avr/suspend_avr.h @@ -7,21 +7,22 @@ #include <avr/wdt.h> #include <avr/interrupt.h> -#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 5be1b7677..8c071e7a0 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/common/keyboard.c b/tmk_core/common/keyboard.c index cb4e7637f..a767d9c87 100644 --- a/tmk_core/common/keyboard.c +++ b/tmk_core/common/keyboard.c @@ -335,7 +335,7 @@ MATRIX_LOOP_END: matrix_scan_perf_task(); #endif -#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) rgblight_task(); #endif diff --git a/tmk_core/protocol/chibios/main.c b/tmk_core/protocol/chibios/main.c index a61ffad12..218a79f8b 100644 --- a/tmk_core/protocol/chibios/main.c +++ b/tmk_core/protocol/chibios/main.c @@ -32,9 +32,8 @@ #include "sendchar.h" #include "debug.h" #include "printf.h" -#include "rgblight_reconfig.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 738c2a6d3..ca75a91d0 100644 --- a/tmk_core/protocol/lufa/lufa.c +++ b/tmk_core/protocol/lufa/lufa.c @@ -54,7 +54,6 @@ #include "quantum.h" #include <util/atomic.h> #include "outputselect.h" -#include "rgblight_reconfig.h" #ifdef NKRO_ENABLE # include "keycode_config.h" @@ -78,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 1e9d65be0..6b3f09bc3 100644 --- a/tmk_core/protocol/vusb/main.c +++ b/tmk_core/protocol/vusb/main.c @@ -20,9 +20,8 @@ #include "timer.h" #include "uart.h" #include "debug.h" -#include "rgblight_reconfig.h" -#if (defined(RGB_MIDI) || defined(RGBLIGHT_ANIMATIONS)) && defined(RGBLIGHT_ENABLE) +#if defined(RGBLIGHT_ENABLE) # include "rgblight.h" #endif |