Added LED support, cleaned up RGB docs
This commit is contained in:
57
docs/rgb.md
57
docs/rgb.md
@@ -12,7 +12,7 @@ Currently we support the following addressable LEDs:
|
||||
* All neopixels
|
||||
|
||||
## Usage
|
||||
At minimum you will need to make sure that these are set in either your keymap ip importing an MCU directly, or it should be included in the predefined boards if they support them.
|
||||
At minimum you will need to make sure that these are set in either your keymap is importing an MCU directly, or it should be included in the predefined boards if they support them.
|
||||
|
||||
|Define |Description |
|
||||
|---------------------|---------------------------------------------|
|
||||
@@ -49,13 +49,19 @@ Changing the **Value** sets the overall brightness.
|
||||
|`KC.RGB_MODE_KNIGHT` |`RGB_M_K` |Knightrider animation |
|
||||
|
||||
## Configuration
|
||||
|Define |Default |Description |
|
||||
|---------------------|-------------|-----------------------------------------------------------------------------|
|
||||
|`keyboard.rgb_order` |`(1, 0, 2)` |The order of the pixels R G B, and optionally white. Example(1, 0, 2, 3) |
|
||||
|`keyboard.hue_step` |`10` |The number of steps to cycle through the hue by |
|
||||
|`keyboard.sat_step` |`17` |The number of steps to increment the saturation by |
|
||||
|`keyboard.val_step` |`17` |The number of steps to increment the brightness by |
|
||||
|`keyboard.val_limit` |`255` |The maximum brightness level |
|
||||
|Define |Default |Description |
|
||||
|-------------------------|-------------|-----------------------------------------------------------------------------|
|
||||
|`keyboard.rgb_order` |`(1, 0, 2)` |The order of the pixels R G B, and optionally white. Example(1, 0, 2, 3) |
|
||||
|`keyboard.rgb_hue_step` |`10` |The number of steps to cycle through the hue by |
|
||||
|`keyboard.rgb_sat_step` |`17` |The number of steps to change the saturation by |
|
||||
|`keyboard.rgb_val_step` |`17` |The number of steps to change the brightness by |
|
||||
|`keyboard.rgb_val_limit` |`255` |The maximum brightness level |
|
||||
|
||||
## Built-in Animation Configuration
|
||||
|Define |Default |Description |
|
||||
|-----------------------------------|-------------|-------------------------------------------------------------------------------------|
|
||||
|`keyboard.rgb_breath_center` |`1.5` |Used to calculate the curve for the breathing animation. Anywhere from 1.0 - 2.7 is valid|
|
||||
|`keyboard.rgb_knight_effect_length`|`4` |The number of LEDs to light up for the "Knight" animation |
|
||||
|
||||
## Functions
|
||||
|
||||
@@ -67,6 +73,7 @@ If you want to create your own animations, or for example, change the lighting i
|
||||
|`keyboard.pixels.set_hsv(hue, sat, val, index)` |Sets a single LED with HSV value |
|
||||
|`keyboard.pixels.set_rgb_fill((r, g, b))` |Fills all LED's with RGB(W) values |
|
||||
|`keyboard.pixels.set_rgb((r, g, b), index)` |Set's a single LED with RGB(W) values |
|
||||
|`keyboard.pixels.disable_auto_write(bool)` |When True, disables showing changes. Good for setting multiple LED's before a visible update|
|
||||
|`keyboard.pixels.increase_hue(step)` |Increases hue by a given step |
|
||||
|`keyboard.pixels.decrease_hue(step)` |Decreases hue by a given step |
|
||||
|`keyboard.pixels.increase_sat(step)` |Increases saturation by a given step |
|
||||
@@ -79,32 +86,28 @@ If you want to create your own animations, or for example, change the lighting i
|
||||
|`keyboard.pixels.show()` |Displays all stored configuration for LED's. Useful with disable_auto_write explained below |
|
||||
|`keyboard.pixels.time_ms()` |Returns a time in ms since the board has booted. Useful for start/stop timers |
|
||||
|
||||
Other settings that are useful that can be changed.
|
||||
## Configuration
|
||||
|Define |Default |Description |
|
||||
|------------------------------|-------------|---------------------------------------------------------------------------------------------------------|
|
||||
|`keyboard.hue` |`0` |Sets the hue from 0-360 |
|
||||
|`keyboard.sat` |`100` |Sets the saturation from 0-100 |
|
||||
|`keyboard.val` |`80` |Sets the brightness from 1-255 |
|
||||
|`keyboard.disable_auto_write` |`False` |When True, disables showing changes. Good for setting multiple LED's before a visible update |
|
||||
|`keyboard.reverse_animation` |`False` |If true, some animations will run in reverse. Can be safely used in user animations |
|
||||
|`keyboard.animation_mode` |`static` |This can be changed to any modes included, or to something custom for user animations. Any string is valid |
|
||||
|`keyboard.animation_speed` |`1` |Increases animation speed of most animations. Recommended 1-5, Maximum 10. |
|
||||
## Direct variable access
|
||||
|Define |Default |Description |
|
||||
|-----------------------------------|-----------|-----------------------------------------------------------------------------------------------------------|
|
||||
|`keyboard.pixels.hue` |`0` |Sets the hue from 0-360 |
|
||||
|`keyboard.pixels.sat` |`100` |Sets the saturation from 0-100 |
|
||||
|`keyboard.pixels.val` |`80` |Sets the brightness from 1-255 |
|
||||
|`keyboard.pixels.reverse_animation`|`False` |If true, some animations will run in reverse. Can be safely used in user animations |
|
||||
|`keyboard.pixels.animation_mode` |`static` |This can be changed to any modes included, or to something custom for user animations. Any string is valid |
|
||||
|`keyboard.pixels.animation_speed` |`1` |Increases animation speed of most animations. Recommended 1-5, Maximum 10. |
|
||||
|
||||
## Built-in Animation Configuration
|
||||
|Define |Default |Description |
|
||||
|-------------------------------|-------------|-------------------------------------------------------------------------------------|
|
||||
|`keyboard.breath_center` |`1.5` |Used to calculate the curve for the breathing animation. Anywhere from 1.0 - 2.7 is valid|
|
||||
|`keyboard.knight_effect_length`|`4` |The number of LEDs to light up for the "Knight" animation |
|
||||
|
||||
## Hardware Modification
|
||||
|
||||
To add LED's to boards that don't support them, you will have to add a 3 wires. The power wire will run on 3.3v or 5v (depending on the LED), ground, and data pins will need added to an unused pin on your microcontroller unless your keyboard has specific solder points for them. With those 3 wires connected, set the pixel_pin as described above, and you are ready to use your LED's/Neopixels.
|
||||
To add RGB LED's to boards that don't support them directly, you will have to add a 3 wires. The power wire will run on 3.3v or 5v (depending on the LED),
|
||||
ground, and data pins will need added to an unused pin on your microcontroller unless your keyboard has specific solder points for them. With those 3 wires
|
||||
connected, set the pixel_pin as described above, and you are ready to use your RGB LED's/Neopixels.
|
||||
|
||||
## ADVANCED USAGE
|
||||
If you wish to interact with these as you would normal LED's and do not want help from KMK, you can disable all helper functions from working and access the neopixel object directly like this.
|
||||
If you wish to interact with these as you would normal LED's and do not want help from KMK, you can disable all helper functions from working and access the
|
||||
neopixel object directly like this.
|
||||
```python
|
||||
keyboard.pixels.disabse_auto_write = True
|
||||
keyboard.pixels.disable_auto_write = True
|
||||
keyboard.pixels.neopixel() # <-- This is the neopixel object
|
||||
```
|
||||
|
||||
|
Reference in New Issue
Block a user