2019-07-13 02:11:36 +02:00
|
|
|
# LED (Mono color backlight)
|
|
|
|
Want your keyboard to shine? Add some lights!
|
2020-10-21 21:19:42 +02:00
|
|
|
|
2021-06-25 19:53:58 +02:00
|
|
|
## Enabling the extension
|
2021-12-09 21:01:22 +01:00
|
|
|
The only required values that you need to give the LED extension would be the
|
|
|
|
`led_pin`. It can either be a single board pin, or a list of pins for multiple
|
|
|
|
LED's.
|
2020-10-21 21:19:42 +02:00
|
|
|
```python
|
2021-12-09 21:01:22 +01:00
|
|
|
from kmk.extensions.LED import LED
|
|
|
|
import board
|
2020-10-21 21:19:42 +02:00
|
|
|
|
2021-12-09 21:01:22 +01:00
|
|
|
led_ext = LED(led_pin=[board.GP0, board.GP1])
|
2020-10-21 21:19:42 +02:00
|
|
|
keyboard.extensions.append(led_ext)
|
|
|
|
```
|
2021-12-09 21:01:22 +01:00
|
|
|
|
2019-07-13 02:11:36 +02:00
|
|
|
## [Keycodes]
|
|
|
|
|
|
|
|
|Key |Aliases |Description |
|
|
|
|
|-----------------------------|-------------------|----------------------------|
|
2021-12-09 21:01:22 +01:00
|
|
|
|`KC.LED_TOG()` | |Toggles LED's |
|
|
|
|
|`KC.LED_INC()` | |Increase Brightness |
|
|
|
|
|`KC.LED_DEC()` | |Decrease Brightness |
|
|
|
|
|`KC.LED_SET()` | |Set Brightness |
|
2019-07-13 02:11:36 +02:00
|
|
|
|`KC.LED_ANI` | |Increase animation speed |
|
|
|
|
|`KC.LED_AND` | |Decrease animation speed |
|
|
|
|
|`KC.LED_MODE_PLAIN` |`LED_M_P` |Static LED's |
|
|
|
|
|`KC.LED_MODE_BREATHE` |`LED_M_B` |Breathing animation |
|
|
|
|
|
2021-12-09 21:01:22 +01:00
|
|
|
Keycodes with arguments can affect all, or a selection of LED's.
|
|
|
|
```python
|
|
|
|
# toggle all LEDs
|
|
|
|
LED_TOG_ALL = KC.LED_TOG()
|
|
|
|
|
|
|
|
# increase brightness of first LED
|
|
|
|
LED_INC_0 = KC.LED_INC(0)
|
|
|
|
|
|
|
|
# decrease brightness of second and third LED
|
|
|
|
LED_DEC_1_2 = KC.LED_DEC(1,2)
|
|
|
|
|
|
|
|
```
|
|
|
|
|
2019-07-13 02:11:36 +02:00
|
|
|
## Configuration
|
2020-10-21 21:19:42 +02:00
|
|
|
All of these values can be set by default for when the keyboard boots.
|
2019-07-13 02:11:36 +02:00
|
|
|
```python
|
2021-06-25 19:53:58 +02:00
|
|
|
from kmk.extensions.led import AnimationModes
|
2020-10-21 21:19:42 +02:00
|
|
|
led_ext = LED(
|
|
|
|
led_pin=led_pin,
|
|
|
|
brightness_step=5,
|
|
|
|
brightness_limit=100,
|
|
|
|
breathe_center=1.5,
|
|
|
|
animation_mode=AnimationModes.STATIC,
|
|
|
|
animation_speed=1,
|
2021-12-09 21:01:22 +01:00
|
|
|
user_animation=None,
|
2020-10-21 21:19:42 +02:00
|
|
|
val=100,
|
|
|
|
)
|
2019-07-13 02:11:36 +02:00
|
|
|
```
|