aboutsummaryrefslogtreecommitdiff
path: root/quantum/quantum.c
diff options
context:
space:
mode:
authorfauxpark <fauxpark@gmail.com>2019-06-20 15:33:39 +1000
committerDrashna Jaelre <drashna@live.com>2019-06-19 22:33:39 -0700
commit317b8095647e208a7ac1ecf6b110051ca46553a8 (patch)
tree724a2dc9d0b5071999f25400c453ca061e1c0827 /quantum/quantum.c
parent67e0c951afee99ac1e1e96354655296457f57b78 (diff)
downloadqmk_firmware-317b8095647e208a7ac1ecf6b110051ca46553a8.tar.gz
qmk_firmware-317b8095647e208a7ac1ecf6b110051ca46553a8.zip
Fix breathing always on for soft PWM (#5983)
* Fix breathing always on for soft PWM * Remove reference to hardware PWM pins in BACKLIGHT_BREATHING description Now, breathing will only be unsupported when Timers 1 and 3 are both used by Audio * Document BACKLIGHT_ON_STATE and its purpose
Diffstat (limited to 'quantum/quantum.c')
-rw-r--r--quantum/quantum.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/quantum/quantum.c b/quantum/quantum.c
index 36b7942d5..6530738b7 100644
--- a/quantum/quantum.c
+++ b/quantum/quantum.c
@@ -707,8 +707,9 @@ bool process_record_quantum(keyrecord_t *record) {
707 707
708#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_BREATHING) 708#if defined(BACKLIGHT_ENABLE) && defined(BACKLIGHT_BREATHING)
709 case BL_BRTG: { 709 case BL_BRTG: {
710 if (record->event.pressed) 710 if (record->event.pressed) {
711 breathing_toggle(); 711 breathing_toggle();
712 }
712 return false; 713 return false;
713 } 714 }
714#endif 715#endif
@@ -1148,13 +1149,13 @@ void backlight_off(uint8_t backlight_pin) {
1148#define BACKLIGHT_PIN_INIT BACKLIGHT_PINS 1149#define BACKLIGHT_PIN_INIT BACKLIGHT_PINS
1149#endif 1150#endif
1150 1151
1151#define FOR_EACH_LED(x) \ 1152#define FOR_EACH_LED(x) \
1152 for (uint8_t i = 0; i < BACKLIGHT_LED_COUNT; i++) \ 1153 for (uint8_t i = 0; i < BACKLIGHT_LED_COUNT; i++) \
1153 { \ 1154 { \
1154 uint8_t backlight_pin = backlight_pins[i]; \ 1155 uint8_t backlight_pin = backlight_pins[i]; \
1155 { \ 1156 { \
1156 x \ 1157 x \
1157 } \ 1158 } \
1158 } 1159 }
1159 1160
1160static const uint8_t backlight_pins[BACKLIGHT_LED_COUNT] = BACKLIGHT_PIN_INIT; 1161static const uint8_t backlight_pins[BACKLIGHT_LED_COUNT] = BACKLIGHT_PIN_INIT;
@@ -1233,7 +1234,9 @@ ISR(TIMERx_COMPA_vect) {
1233// this one triggers at F_CPU/65536 =~ 244 Hz 1234// this one triggers at F_CPU/65536 =~ 244 Hz
1234ISR(TIMERx_OVF_vect) { 1235ISR(TIMERx_OVF_vect) {
1235#ifdef BACKLIGHT_BREATHING 1236#ifdef BACKLIGHT_BREATHING
1236 breathing_task(); 1237 if(is_breathing()) {
1238 breathing_task();
1239 }
1237#endif 1240#endif
1238 // for very small values of OCRxx (or backlight level) 1241 // for very small values of OCRxx (or backlight level)
1239 // we can't guarantee this whole code won't execute 1242 // we can't guarantee this whole code won't execute