* 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
* Fix backlight breathing on C6
* Account for ATmega32A's single TIMSK register (MT40)
* Document hardware PWM on D4 for ATmega32A
* Add C6 and D4 to BACKLIGHT_PIN description
With my XD60, I noticed that when typing the backlight was flickering.
The XD60 doesn't have the backlight wired to a hardware PWM pin.
I assumed it was a timing issue in the matrix scan that made the PWM
lit the LED a bit too longer. I verified it because the more keys that
were pressed, the more lighting I observed.
This patch makes the software PWM be called during CPU interruptions.
It works almost like the hardware PWM, except instead of using
the CPU waveform generation, the CPU will fire interruption
when the LEDs need be turned on or off.
Using the same timer system as for hardware PWM, when the counter
will reach OCRxx (the current backlight level), an Output Compare
match interrupt will be fired and we'll turn the LEDs off.
When the counter reaches its maximum value, an overflow interrupt
will be triggered in which we turn the LEDs on.
This way we replicate the hardware backlight PWM duty cycle.
This gives a better time stability of the PWM computation than pure
software PWM, leading to a flicker free backlight.
Since this is reusing the hardware PWM code, software PWM also supports
backlight breathing.
Note that if timer1 is used for audio, backlight will use timer3, and if
timer3 is used for audio backlight will use timer1.
If both timers are used for audio, then this feature is disabled and we
revert to the matrix scan based PWM computation.
Signed-off-by: Brice Figureau <brice@daysofwonder.com>
* [BACKLIGHT_CAPS_LOCK_INDICATOR] Use backlight toggling as Caps Lock LED
I've implemented this feature because S65-X doesn't have LED indicators
and the existing led_set_kb(usb_led) function try to use backlight as
indicator but that creates an inconsistency with backlight_config state.
- define `BACKLIGHT_CAPS_LOCK_INDICATOR` to enable Caps Lock indicator
using backlight (for keyboards without dedicated LED)
- Don't turn off LED indicators when suspend because backlight is
already turned off. Else led_set(0) will turn back on backlight.
- Documentation has been updated
* [BACKLIGHT_CAPS_LOCK_INDICATOR] Turn off all LED indicators except Caps Lock if BACKLIGHT_CAPS_LOCK_INDICATOR
* [BACKLIGHT_CAPS_LOCK] Rename BACKLIGHT_CAPS_LOCK_INDICATOR
* [BACKLIGHT_CAPS_LOCK] Use new IS_LED_ON method
* add functions to set specific backlight state
* add function to query backlight state
* update documentation with new backlight functions
* Update tmk_core/common/backlight.c
Co-Authored-By: codyd51 <phillip.ennen@gmail.com>
* Update tmk_core/common/backlight.h
Co-Authored-By: codyd51 <phillip.ennen@gmail.com>
* update docs for is_backlight_enabled() name change
* add breathing to bananasplit
* backlight breathing overhaul
* fix the backlight_tick thing.
* fix for vision_division backlight
* fix a few keymaps and probably break breathing for some weirdly set-up boards.
* remove BL_x keycodes because they made unreasonable assumptions
* some fixes for BL keycodes
* integer cie lightness scaling
* use cie lightness for non-breathing backlight and make breathing able to reach true max brightness