summaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-07-16 17:56:36 +1000
committerFlorian Didron <fdidron@users.noreply.github.com>2019-07-19 10:16:35 +0900
commit408356533460cb12adad96f65e4c8a8494afa4b7 (patch)
tree88980cfe237ca1c749af01152c4146db63c3d722 /quantum/quantum.c
parentb279d2b94e1687180a1d4da354888152e584a900 (diff)
Store backlight breathing state in EEPROM (#6105)
* Store backlight breathing state in EEPROM * Reduce backlight_config.level from 6 bits to 4 (max 15 "on" levels) * Error out if BACKLIGHT_LEVELS is > 15 * Remove mention of default backlight pin in rules.mk template * Remove pointless comment
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 903ca775b6..4d80cc1470 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -703,8 +703,9 @@ bool process_record_quantum(keyrecord_t *record) {
#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_BREATHING)
case BL_BRTG: {
- if (record->event.pressed)
- breathing_toggle();
+ if (record->event.pressed) {
+ backlight_toggle_breathing();
+ }
return false;
}
#endif
@@ -1070,14 +1071,15 @@ __attribute__ ((weak))
void backlight_init_ports(void)
{
// Setup backlight pin as output and output to on state.
- // DDRx |= n
- _SFR_IO8((backlight_pin >> 4) + 1) |= _BV(backlight_pin & 0xF);
- #if BACKLIGHT_ON_STATE == 0
- // PORTx &= ~n
- _SFR_IO8((backlight_pin >> 4) + 2) &= ~_BV(backlight_pin & 0xF);
- #else
- // PORTx |= n
- _SFR_IO8((backlight_pin >> 4) + 2) |= _BV(backlight_pin & 0xF);
+ FOR_EACH_LED(
+ setPinOutput(backlight_pin);
+ backlight_on(backlight_pin);
+ )
+
+ #ifdef BACKLIGHT_BREATHING
+ if (is_backlight_breathing()) {
+ breathing_enable();
+ }
#endif
}
@@ -1303,7 +1305,9 @@ void backlight_init_ports(void)
backlight_init();
#ifdef BACKLIGHT_BREATHING
- breathing_enable();
+ if (is_backlight_breathing()) {
+ breathing_enable();
+ }
#endif
}