aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDrashna Jaelre <drashna@live.com>2018-03-19 20:59:58 -0700
committerJack Humbert <jack.humb@gmail.com>2018-03-19 23:59:58 -0400
commitff728a8a01c1aa81e86f38dfd1753bd49ce39e88 (patch)
treebb901542cc04283323efb63d574391304f85b091
parent37cc08848615c2efa8c291b561f8c33048360fb5 (diff)
downloadqmk_firmware-ff728a8a01c1aa81e86f38dfd1753bd49ce39e88.tar.gz
qmk_firmware-ff728a8a01c1aa81e86f38dfd1753bd49ce39e88.zip
[Proposal?] Allow RGB Underglow to turn off when host is idle/asleep (#2104)
* Add RGB Underglow Sleeping * Add RGBLIGHT_SLEEP to toggle/control RGB light behavior * Update rgb docs * Update for RGB disable command
-rw-r--r--docs/feature_rgblight.md2
-rw-r--r--keyboards/ergodox_ez/keymaps/drashna/config.h1
-rw-r--r--keyboards/handwired/woodpad/keymaps/drashna/config.h1
-rw-r--r--keyboards/orthodox/keymaps/drashna/config.h1
-rw-r--r--keyboards/viterbi/keymaps/drashna/config.h1
-rw-r--r--tmk_core/common/avr/suspend.c16
6 files changed, 21 insertions, 1 deletions
diff --git a/docs/feature_rgblight.md b/docs/feature_rgblight.md
index f96fa8773..17097f4bc 100644
--- a/docs/feature_rgblight.md
+++ b/docs/feature_rgblight.md
@@ -42,6 +42,8 @@ You can change the behavior of the RGB Lighting by setting these configuration v
42| `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. | 42| `RGBLIGHT_SAT_STEP` | 17 | How many steps of saturation you'd like. |
43| `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. | 43| `RGBLIGHT_VAL_STEP` | 17 | The number of levels of brightness you want. |
44| `RGBLIGHT_LIMIT_VAL` | 255 | Limit the val of HSV to limit the maximum brightness simply. | 44| `RGBLIGHT_LIMIT_VAL` | 255 | Limit the val of HSV to limit the maximum brightness simply. |
45| `RGBLIGHT_SLEEP` | | `#define` this will shut off the lights when the host goes to sleep |
46
45 47
46### Animations 48### Animations
47 49
diff --git a/keyboards/ergodox_ez/keymaps/drashna/config.h b/keyboards/ergodox_ez/keymaps/drashna/config.h
index d543379a3..71c7de466 100644
--- a/keyboards/ergodox_ez/keymaps/drashna/config.h
+++ b/keyboards/ergodox_ez/keymaps/drashna/config.h
@@ -10,6 +10,7 @@
10#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7 10#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 7
11#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7 11#define RGBLIGHT_EFFECT_SNAKE_LENGTH 7
12#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 12#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
13#define RGBLIGHT_SLEEP
13#endif // RGBLIGHT_ENABLE 14#endif // RGBLIGHT_ENABLE
14 15
15#ifdef TAPPING_TERM 16#ifdef TAPPING_TERM
diff --git a/keyboards/handwired/woodpad/keymaps/drashna/config.h b/keyboards/handwired/woodpad/keymaps/drashna/config.h
index a35b60d36..c83a1ac37 100644
--- a/keyboards/handwired/woodpad/keymaps/drashna/config.h
+++ b/keyboards/handwired/woodpad/keymaps/drashna/config.h
@@ -37,6 +37,7 @@
37#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 4 37#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 4
38#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3 38#define RGBLIGHT_EFFECT_SNAKE_LENGTH 3
39#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 39#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
40#define RGBLIGHT_SLEEP
40#endif // RGBLIGHT_ENABLE 41#endif // RGBLIGHT_ENABLE
41 42
42#define FORCE_NKRO 43#define FORCE_NKRO
diff --git a/keyboards/orthodox/keymaps/drashna/config.h b/keyboards/orthodox/keymaps/drashna/config.h
index 107f16d58..dd8439a44 100644
--- a/keyboards/orthodox/keymaps/drashna/config.h
+++ b/keyboards/orthodox/keymaps/drashna/config.h
@@ -64,6 +64,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
64#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 64#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
65#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 65#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
66#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 66#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
67#define RGBLIGHT_SLEEP
67#endif // RGBLIGHT_ENABLE 68#endif // RGBLIGHT_ENABLE
68 69
69#ifdef AUDIO_ENABLE 70#ifdef AUDIO_ENABLE
diff --git a/keyboards/viterbi/keymaps/drashna/config.h b/keyboards/viterbi/keymaps/drashna/config.h
index 8fabe72f8..02786cfc7 100644
--- a/keyboards/viterbi/keymaps/drashna/config.h
+++ b/keyboards/viterbi/keymaps/drashna/config.h
@@ -31,6 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2 31#define RGBLIGHT_EFFECT_KNIGHT_LENGTH 2
32#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2 32#define RGBLIGHT_EFFECT_SNAKE_LENGTH 2
33#define RGBLIGHT_EFFECT_BREATHE_CENTER 1 33#define RGBLIGHT_EFFECT_BREATHE_CENTER 1
34#define RGBLIGHT_SLEEP
34#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 300 35#define RGBLIGHT_EFFECT_CHRISTMAS_INTERVAL 300
35#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1 36#define RGBLIGHT_EFFECT_CHRISTMAS_STEP 1
36 37
diff --git a/tmk_core/common/avr/suspend.c b/tmk_core/common/avr/suspend.c
index 1c7618ff5..213f03f6f 100644
--- a/tmk_core/common/avr/suspend.c
+++ b/tmk_core/common/avr/suspend.c
@@ -19,6 +19,9 @@
19 #include "audio.h" 19 #include "audio.h"
20#endif /* AUDIO_ENABLE */ 20#endif /* AUDIO_ENABLE */
21 21
22#ifdef RGBLIGHT_ANIMATIONS
23 #include "rgblight.h"
24#endif
22 25
23 26
24#define wdt_intr_enable(value) \ 27#define wdt_intr_enable(value) \
@@ -85,7 +88,12 @@ static void power_down(uint8_t wdto)
85 // This sometimes disables the start-up noise, so it's been disabled 88 // This sometimes disables the start-up noise, so it's been disabled
86 // stop_all_notes(); 89 // stop_all_notes();
87 #endif /* AUDIO_ENABLE */ 90 #endif /* AUDIO_ENABLE */
88 91#ifdef RGBLIGHT_SLEEP
92#ifdef RGBLIGHT_ANIMATIONS
93 rgblight_timer_disable();
94#endif
95 rgblight_disable();
96#endif
89 // TODO: more power saving 97 // TODO: more power saving
90 // See PicoPower application note 98 // See PicoPower application note
91 // - I/O port input with pullup 99 // - I/O port input with pullup
@@ -132,6 +140,12 @@ void suspend_wakeup_init(void)
132 backlight_init(); 140 backlight_init();
133#endif 141#endif
134 led_set(host_keyboard_leds()); 142 led_set(host_keyboard_leds());
143#ifdef RGBLIGHT_SLEEP
144 rgblight_enable();
145#ifdef RGBLIGHT_ANIMATIONS
146 rgblight_timer_enable();
147#endif
148#endif
135} 149}
136 150
137#ifndef NO_SUSPEND_POWER_DOWN 151#ifndef NO_SUSPEND_POWER_DOWN