aboutsummaryrefslogtreecommitdiff
path: root/tmk_core/common
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common')
-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
4 files changed, 18 insertions, 43 deletions
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 @@
9#include "timer.h" 9#include "timer.h"
10#include "led.h" 10#include "led.h"
11#include "host.h" 11#include "host.h"
12#include "rgblight_reconfig.h"
13 12
14#ifdef PROTOCOL_LUFA 13#ifdef PROTOCOL_LUFA
15# include "lufa.h" 14# include "lufa.h"
@@ -30,23 +29,6 @@ static bool rgblight_enabled;
30static bool is_suspended; 29static bool is_suspended;
31#endif 30#endif
32 31
33#define wdt_intr_enable(value) \
34 __asm__ __volatile__("in __tmp_reg__,__SREG__" \
35 "\n\t" \
36 "cli" \
37 "\n\t" \
38 "wdr" \
39 "\n\t" \
40 "sts %0,%1" \
41 "\n\t" \
42 "out __SREG__,__tmp_reg__" \
43 "\n\t" \
44 "sts %0,%2" \
45 "\n\t" \
46 : /* no outputs */ \
47 : "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))) \
48 : "r0")
49
50/** \brief Suspend idle 32/** \brief Suspend idle
51 * 33 *
52 * FIXME: needs doc 34 * FIXME: needs doc
@@ -122,9 +104,7 @@ static void power_down(uint8_t wdto) {
122 // stop_all_notes(); 104 // stop_all_notes();
123# endif /* AUDIO_ENABLE */ 105# endif /* AUDIO_ENABLE */
124# if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) 106# if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
125# ifdef RGBLIGHT_ANIMATIONS
126 rgblight_timer_disable(); 107 rgblight_timer_disable();
127# endif
128 if (!is_suspended) { 108 if (!is_suspended) {
129 is_suspended = true; 109 is_suspended = true;
130 rgblight_enabled = rgblight_config.enable; 110 rgblight_enabled = rgblight_config.enable;
@@ -204,9 +184,7 @@ void suspend_wakeup_init(void) {
204# endif 184# endif
205 rgblight_enable_noeeprom(); 185 rgblight_enable_noeeprom();
206 } 186 }
207# ifdef RGBLIGHT_ANIMATIONS
208 rgblight_timer_enable(); 187 rgblight_timer_enable();
209# endif
210#endif 188#endif
211 suspend_wakeup_init_kb(); 189 suspend_wakeup_init_kb();
212} 190}
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 @@
7#include <avr/wdt.h> 7#include <avr/wdt.h>
8#include <avr/interrupt.h> 8#include <avr/interrupt.h>
9 9
10#define wdt_intr_enable(value) \ 10// clang-format off
11 __asm__ __volatile__("in __tmp_reg__,__SREG__" \ 11#define wdt_intr_enable(value) \
12 "\n\t" \ 12__asm__ __volatile__ ( \
13 "cli" \ 13 "in __tmp_reg__,__SREG__" "\n\t" \
14 "\n\t" \ 14 "cli" "\n\t" \
15 "wdr" \ 15 "wdr" "\n\t" \
16 "\n\t" \ 16 "sts %0,%1" "\n\t" \
17 "sts %0,%1" \ 17 "out __SREG__,__tmp_reg__" "\n\t" \
18 "\n\t" \ 18 "sts %0,%2" "\n\t" \
19 "out __SREG__,__tmp_reg__" \ 19 : /* no outputs */ \
20 "\n\t" \ 20 : "M" (_SFR_MEM_ADDR(_WD_CONTROL_REG)), \
21 "sts %0,%2" \ 21 "r" (_BV(_WD_CHANGE_BIT) | _BV(WDE)), \
22 "\n\t" \ 22 "r" ((uint8_t) ((value & 0x08 ? _WD_PS3_MASK : 0x00) | \
23 : /* no outputs */ \ 23 _BV(WDIE) | (value & 0x07)) ) \
24 : "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))) \ 24 : "r0" \
25 : "r0") 25)
26// clang-format on
26 27
27#endif 28#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) {
51 // shouldn't power down TPM/FTM if we want a breathing LED 51 // shouldn't power down TPM/FTM if we want a breathing LED
52 // also shouldn't power down USB 52 // also shouldn't power down USB
53#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE) 53#if defined(RGBLIGHT_SLEEP) && defined(RGBLIGHT_ENABLE)
54# ifdef RGBLIGHT_ANIMATIONS
55 rgblight_timer_disable(); 54 rgblight_timer_disable();
56# endif
57 if (!is_suspended) { 55 if (!is_suspended) {
58 is_suspended = true; 56 is_suspended = true;
59 rgblight_enabled = rgblight_config.enable; 57 rgblight_enabled = rgblight_config.enable;
@@ -126,9 +124,7 @@ void suspend_wakeup_init(void) {
126 if (rgblight_enabled) { 124 if (rgblight_enabled) {
127 rgblight_enable_noeeprom(); 125 rgblight_enable_noeeprom();
128 } 126 }
129# ifdef RGBLIGHT_ANIMATIONS
130 rgblight_timer_enable(); 127 rgblight_timer_enable();
131# endif
132#endif 128#endif
133 suspend_wakeup_init_kb(); 129 suspend_wakeup_init_kb();
134} 130}
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:
335 matrix_scan_perf_task(); 335 matrix_scan_perf_task();
336#endif 336#endif
337 337
338#if defined(RGBLIGHT_ANIMATIONS) && defined(RGBLIGHT_ENABLE) 338#if defined(RGBLIGHT_ENABLE)
339 rgblight_task(); 339 rgblight_task();
340#endif 340#endif
341 341