summaryrefslogtreecommitdiff
path: root/tmk_core
diff options
context:
space:
mode:
authorTakeshi ISHII <2170248+mtei@users.noreply.github.com>2020-03-10 17:46:03 +0900
committerFlorian Didron <fdidron@users.noreply.github.com>2020-06-12 17:00:27 +0900
commit316feba8487df07e1d80a45f5fa14d5a9ed9c35d (patch)
treed312d0a5dba307f8067ff639d97190e303b1d6f1 /tmk_core
parent928cb8ef92671806582f0f5ff8f9a83a17cb1796 (diff)
Refactor rgblight_reconfig.h (#7773)
* 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 ``` * Expressions that are too long are difficult to read, so wrap them. * Edit the expression again * 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 ``` * remove 'defined(RGBLIGHT_ANIMATIONS)' in tmk_core/common/keyboard.c Co-authored-by: Joel Challis <git@zvecr.com>
Diffstat (limited to 'tmk_core')
-rw-r--r--tmk_core/common/avr/suspend.c22
-rw-r--r--tmk_core/common/avr/suspend_avr.h33
-rw-r--r--tmk_core/common/chibios/suspend.c4
-rw-r--r--tmk_core/common/keyboard.c2
-rw-r--r--tmk_core/protocol/chibios/main.c3
-rw-r--r--tmk_core/protocol/lufa/lufa.c3
-rw-r--r--tmk_core/protocol/vusb/main.c3
7 files changed, 21 insertions, 49 deletions
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index c59c196880..11ac146eb8 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 d73852ba11..e4cc0be505 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 5be1b76777..8c071e7a08 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 95238d1c4c..d576d565d1 100644
--- a/tmk_core/common/keyboard.c
+++ b/tmk_core/common/keyboard.c
@@ -330,7 +330,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 76e6e23776..3f7f94285f 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 9ab1b8ae90..12374227cf 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 1e9d65be0b..6b3f09bc3e 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