Commit Graph

13 Commits (8af3fe0c7dfce74477f86be19711c7ec4a70ccb2)

Author SHA1 Message Date
fauxpark 6bdcbfb25a Fix backlight breathing on C6 (#6102)
* 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
2019-06-17 19:37:17 -07:00
Brice Figureau b61baf4281 Fix #3566 use an hardware timer for software PWM stability (#3615)
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>
2019-04-22 08:34:13 -07:00
Rockman18 df251d7a13 Backlight - New option : BACKLIGHT_CAPS_LOCK (#4769)
* [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
2019-01-28 16:57:56 -08:00
Phillip Tennen 0cda2f43e2 Backlight status functions (#4259)
* 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
2018-11-14 07:45:46 -08:00
Phillip Tennen fa1ac4d724 Fix incorrect doctoring in feature.backlight.md (#4244)
I'm guessing someone deleted a row at some point in the past, but I didn't blame it.
2018-10-26 06:59:41 -07:00
Drashna Jaelre eb19fb5b57 Helpful functions 2018-08-26 07:32:15 -07:00
fauxpark 9b7a3a0bc8 Docs: Add Usage section to backlight docs (#3537) 2018-07-31 17:40:09 -07:00
fauxpark 98fa82ceef Backlighting docs (#3526)
* Some words about backlighting

* Link to RGB feature pages
2018-07-30 23:22:52 -07:00
fauxpark 4764e77121 Clarify that we actually have max 16 total backlight levels 2018-01-12 12:52:35 -05:00
fauxpark cfcf0fd36b Remove reference to BL_x in keycodes.md, and add BL_BRTG 2018-01-12 12:52:35 -05:00
Balz Guenat 4931510ad3 backlight breathing overhaul (#2187)
* 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
2018-01-01 17:47:51 -05:00
fauxpark 4c675a83ba Format keycode tables 2017-12-09 10:46:11 -05:00
skullY 9b879b1267 break up keymaps and quantum keycodes into files by feature 2017-08-16 15:47:20 -04:00