You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: Move more sections under hardware integration (#2704)
docs: Move battery sensing hardware integration to new page
docs: Refactor lighting hardware integrations to new category
docs: Link to pin control page from lighting pages
docs: Consolidate lighting feature pages
docs: Remove incorrect redirect
docs: Consolidate lighting config pages
Copy file name to clipboardexpand all lines: docs/blog/2020-08-12-zmk-sotf-1.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ With interest and Discord activity growing, it seemed important to lay out the p
14
14
15
15
There's been lots of various activity in ZMK land!
16
16
17
-
-[Nicell](https://github.com/Nicell) (nice!nano creator) contributed initial [RGB Underglow](/docs/features/underglow) ([#64](https://github.com/zmkfirmware/zmk/pull/64)) support to ZMK.
17
+
-[Nicell](https://github.com/Nicell) (nice!nano creator) contributed initial [RGB Underglow](/docs/features/lighting#rgb-underglow) ([#64](https://github.com/zmkfirmware/zmk/pull/64)) support to ZMK.
18
18
- Tons of [documentation](/docs) work.
19
19
- Refactoring ([#73](https://github.com/zmkfirmware/zmk/pull/73), [#74](https://github.com/zmkfirmware/zmk/pull/74)) of [keymaps](/docs/keymaps) to make them simpler for users.
20
20
- Mod-Tap Behavior (docs coming!) is much improved ([#69](https://github.com/zmkfirmware/zmk/pull/69)) and usable now.
Copy file name to clipboardexpand all lines: docs/blog/2022-04-02-zephyr-3-0.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -73,7 +73,7 @@ The following changes have [already been completed](https://github.com/zmkfirmwa
73
73
74
74
### RGB Underglow
75
75
76
-
Zephyr's WS2812 `led_strip` driver added a new required property. When adding [underglow](/docs/features/underglow#adding-rgb-underglow-to-a-board) to a board, you now must also add the additional include `#include <dt-bindings/led/led.h>` at the top of your devicetree file, and add a `color-mapping` property like:
76
+
Zephyr's WS2812 `led_strip` driver added a new required property. When adding [underglow](/docs/features/lighting#adding-rgb-underglow-support-to-a-keyboard) to a board, you now must also add the additional include `#include <dt-bindings/led/led.h>` at the top of your devicetree file, and add a `color-mapping` property like:
Copy file name to clipboardexpand all lines: docs/blog/2022-04-10-zmk-sotf-5.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ Another persistent bug that Apple users experienced was related to crashes and p
130
130
131
131
The long awaited locality enhancement was finally merged by [petejohanson] in [#547](https://github.com/zmkfirmware/zmk/pull/547), allowing more fine grained control of where certain behaviors are invoked. Some key improvements thanks to the changes:
132
132
133
-
-[RGB Underglow](/docs/features/underglow) behaviors now run globally, so enabling/disabling RGB, changing the color, animation, etc. applies to both sides of a split properly.
133
+
-[RGB Underglow](/docs/features/lighting#rgb-underglow) behaviors now run globally, so enabling/disabling RGB, changing the color, animation, etc. applies to both sides of a split properly.
134
134
-[Reset](/docs/keymaps/behaviors/reset#reset)/[Bootloader](/docs/keymaps/behaviors/reset#bootloader-reset) behaviors now run wherever the key was pressed. For example, adding a `&bootloader` reference to the peripheral side of a split will now put that side of the split into the bootloader when pressed.
135
135
136
136
#### Split Connections
@@ -141,7 +141,7 @@ The long awaited locality enhancement was finally merged by [petejohanson] in [#
141
141
142
142
#### Backlight
143
143
144
-
[bortoz](https://github.com/bortoz) added [single color backlight support](/docs/features/backlight) in [#904](https://github.com/zmkfirmware/zmk/pull/904) for those keyboards that have it as an alternative to RGB underglow.
144
+
[bortoz](https://github.com/bortoz) added [single color backlight support](/docs/features/lighting#backlight) in [#904](https://github.com/zmkfirmware/zmk/pull/904) for those keyboards that have it as an alternative to RGB underglow.
Copy file name to clipboardexpand all lines: docs/blog/2023-10-05-zmk-sotf-6.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,7 @@ This refactor paved way to implementing a long-awaited feature, encoder support
130
130
131
131
#### Underglow auto-off options
132
132
133
-
[ReFil] added two [new RGB auto off options](/docs/config/underglow), one using an idle timeout and the other USB status in [#1010](https://github.com/zmkfirmware/zmk/pull/1010).
133
+
[ReFil] added two [new RGB auto off options](/docs/config/lighting#rgb-underglow), one using an idle timeout and the other USB status in [#1010](https://github.com/zmkfirmware/zmk/pull/1010).
Copy file name to clipboardexpand all lines: docs/docs/config/lighting.md
+48-6
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,17 @@
1
1
---
2
-
title: RGB Underglow Configuration
3
-
sidebar_label: RGB Underglow
2
+
title: Lighting Configuration
3
+
sidebar_label: Lighting
4
4
---
5
5
6
-
See the [RGB Underglow feature page](../features/underglow.md) for more details, including instructions for adding underglow support to a board.
6
+
See the [Lighting feature page](../features/lighting.md) for an overview of the available lighting systems in ZMK.
7
+
8
+
## RGB Underglow
9
+
10
+
See the [RGB underglow section](../features/lighting.md#rgb-underglow) in the Lighting feature page for more details, and [hardware integration page](../development/hardware-integration/lighting/underglow.md) for adding underglow support to a board.
7
11
8
12
See [Configuration Overview](index.md) for instructions on how to change these settings.
9
13
10
-
## Kconfig
14
+
###Kconfig
11
15
12
16
RGB underglow depends on [Zephyr's LED strip driver](https://github.com/zephyrproject-rtos/zephyr/tree/main/drivers/led_strip), which provides additional Kconfig options.
13
17
@@ -44,8 +48,46 @@ Values for `CONFIG_ZMK_RGB_UNDERGLOW_EFF_START`:
44
48
The `*_START` settings only determine the initial underglow state. Any changes you make with the [underglow behavior](../keymaps/behaviors/underglow.md) are saved to flash after a one minute delay and will be used after that.
45
49
:::
46
50
47
-
## Devicetree
51
+
###Devicetree
48
52
49
53
ZMK does not have any Devicetree properties of its own. See the Devicetree bindings for [Zephyr's LED strip drivers](https://github.com/zephyrproject-rtos/zephyr/tree/main/dts/bindings/led_strip).
50
54
51
-
See the [RGB underglow feature page](../features/underglow.md) for examples of the properties that must be set to enable underglow.
55
+
See the [RGB underglow hardware integration page](../development/hardware-integration/lighting/underglow.md) for examples of the properties that must be set to enable underglow.
56
+
57
+
## Backlight
58
+
59
+
See the [backlight section](../features/lighting.md#backlight) in Lighting feature page for more details, and [hardware integration page](../development/hardware-integration/lighting/backlight.mdx) for adding backlight support to a board.
60
+
61
+
See [Configuration Overview](index.md) for instructions on how to change these settings.
|`CONFIG_ZMK_BACKLIGHT`| bool | Enables LED backlight | n |
70
+
|`CONFIG_ZMK_BACKLIGHT_BRT_STEP`| int | Brightness step in percent | 20 |
71
+
|`CONFIG_ZMK_BACKLIGHT_BRT_START`| int | Default brightness in percent | 40 |
72
+
|`CONFIG_ZMK_BACKLIGHT_ON_START`| bool | Default backlight state | y |
73
+
|`CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE`| bool | Turn off backlight when keyboard goes into idle state | n |
74
+
|`CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB`| bool | Turn off backlight when USB is disconnected | n |
75
+
76
+
:::note
77
+
The `*_START` settings only determine the initial backlight state. Any changes you make with the [backlight behavior](../keymaps/behaviors/backlight.md) are saved to flash after a one minute delay and will be used after that.
78
+
:::
79
+
80
+
### Devicetree
81
+
82
+
Applies to: [`/chosen` node](https://docs.zephyrproject.org/3.5.0/build/dts/intro-syntax-structure.html#aliases-and-chosen-nodes)
See the [backlight hardware integration page](../development/hardware-integration/lighting/backlight.mdx) for examples of the properties that must be set to enable backlighting.
If your keyboard is using one of the [boards supported in ZMK](../../hardware.mdx) it will already be configured to [sense and report battery levels](../../features/battery.md).
7
+
Below instructions are only intended for users defining and using a custom board.
8
+
9
+
To enable a battery sensor on a new board, add the driver for the sensor to your board's `.dts` file. ZMK provides two drivers for estimating the battery level using its voltage:
10
+
11
+
-`zmk,battery-voltage-divider`: Reads the voltage on an analog input pin.
12
+
-`zmk,battery-nrf-vddh`: Reads the power supply voltage on a Nordic nRF52's VDDH pin.
13
+
14
+
See the [battery level configuration page](../../config/battery.md) for the configuration supported by each driver provided by ZMK.
15
+
16
+
Zephyr also provides some drivers for fuel gauge ICs such as the TI bq274xx series and Maxim MAX17xxx series. If you use a battery sensor that does not have an existing driver, you will need to write a new driver that supports the `SENSOR_CHAN_GAUGE_STATE_OF_CHARGE` sensor channel and contribute it to Zephyr or ZMK.
17
+
18
+
Once you have the sensor driver defined, add a `zmk,battery` property to the `chosen` node and set it to reference the sensor node. For example:
Copy file name to clipboardexpand all lines: docs/docs/development/hardware-integration/lighting/backlight.mdx
+9-33
Original file line number
Diff line number
Diff line change
@@ -1,45 +1,18 @@
1
1
---
2
2
title: Backlight
3
3
sidebar_label: Backlight
4
+
description: Lighting system that controls an array of single-color LEDs.
4
5
---
5
6
6
7
importTabsfrom"@theme/Tabs";
7
8
importTabItemfrom"@theme/TabItem";
8
9
9
-
Backlight is a feature used to control an array of LEDs, usually placed through or under switches.
10
-
11
-
:::info
12
-
Unlike [RGB Underglow](underglow.md), backlight can only control single color LEDs. Additionally, because backlight LEDs all receive the same power, it's not possible to dim individual LEDs.
13
-
:::
14
-
15
-
## Enabling Backlight
16
-
17
-
To enable backlight on your board or shield, add the following line to your `.conf` file of your user config directory as such:
18
-
19
-
```ini
20
-
CONFIG_ZMK_BACKLIGHT=y
21
-
```
22
-
23
-
If your board or shield does not have backlight configured, refer to [Adding Backlight to a board or a shield](#adding-backlight-to-a-board-or-a-shield).
24
-
25
-
## Configuring Backlight
26
-
27
-
There are various Kconfig options used to configure the backlight feature. These can all be set in the `.conf` file.
|`CONFIG_ZMK_BACKLIGHT_BRT_STEP`| Brightness step in percent | 20 |
32
-
|`CONFIG_ZMK_BACKLIGHT_BRT_START`| Default brightness in percent | 40 |
33
-
|`CONFIG_ZMK_BACKLIGHT_ON_START`| Default backlight state | y |
34
-
|`CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE`| Turn off backlight when keyboard goes into idle state | n |
35
-
|`CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB`| Turn off backlight when USB is disconnected | n |
36
-
37
-
## Adding Backlight to a Board or a Shield
10
+
Please see [lighting feature page](../../../features/lighting.md#backlight) for an introduction on the feature.
38
11
39
12
<Tabs
40
-
defaultValue="shieldpin"
41
-
values={[
42
-
{label: 'Adding to a board', value: 'boardpin'},{label: 'Adding to a shield', value: 'shieldpin'},
13
+
defaultValue="shieldpin"
14
+
values={[
15
+
{label: 'Adding to a board', value: 'boardpin'},{label: 'Adding to a shield', value: 'shieldpin'},
43
16
]}>
44
17
45
18
<TabItemvalue="boardpin">
@@ -59,8 +32,9 @@ endif # ZMK_BACKLIGHT
59
32
```
60
33
61
34
Create a `<board>-pinctrl.dtsi` file if it does not already exist, and include it at the beginning of the `<board>.dts` file. `CONFIG_PINCTRL=y` must be added to `<board>_defconfig` if it isn't already enabled.
35
+
See the documentation page on [pin control](../pinctrl.mdx) for detailed information on setting up pins for hardware protocols such as PWM that is used for controlling backlight LEDs.
62
36
63
-
The pinctrl file has a `&pinctrl` node that encompasses all pinctrl settings, including I2C or SPI peripherals (e.g. WS2812 LEDs, Battery fuel gauges):
37
+
The pinctrl file has a `&pinctrl` node that encompasses all pinctrl settings, including I2C or SPI peripherals (e.g. WS2812 LEDs, battery fuel gauges):
64
38
65
39
```dts
66
40
&pinctrl {
@@ -161,6 +135,8 @@ Then add the following lines to your `.overlay` file:
161
135
};
162
136
```
163
137
138
+
See the documentation page on [pin control](../pinctrl.mdx) for detailed information on setting up pins for hardware protocols such as PWM that is used for controlling backlight LEDs.
139
+
164
140
Pin numbers are handled differently depending on the MCU. On nRF MCUs pins are configured using `(PWM_OUTX, Y, Z)`, where `X` is the PWM channel used (usually 0), `Y` is the first part of the hardware port (_PY.01_) and `Z` is the second part of the hardware port (_P1.Z_).
165
141
166
142
For example, _P1.13_ would give you `(PWM_OUT0, 1, 13)` and _P0.15_ would give you `(PWM_OUT0, 0, 15)`.
Copy file name to clipboardexpand all lines: docs/docs/development/hardware-integration/lighting/underglow.md
+3-54
Original file line number
Diff line number
Diff line change
@@ -1,64 +1,13 @@
1
1
---
2
2
title: RGB Underglow
3
3
sidebar_label: RGB Underglow
4
+
description: Lighting system that controls strips of RGB LEDs.
4
5
---
5
6
6
-
RGB underglow is a feature used to control "strips" of RGB LEDs. Most of the time this is called underglow and creates a glow underneath the board using a ring of LEDs around the edge, hence the name. However, this can be extended to be used to control anything from a single LED to a long string of LEDs anywhere on the keyboard.
7
-
8
-
:::info
9
-
RGB underglow can also be used for per-key lighting. If you have RGB LEDs on your keyboard, this is what you want. For PWM/single color LEDs, see [Backlight](backlight.mdx).
10
-
:::
11
-
12
-
ZMK relies on Zephyr's `led-strip` drivers for this feature. The following LEDs/LED families have been implemented:
13
-
14
-
- WS2812 (includes WS2812B, WS2813, SK6812, and others)
15
-
- APA102
16
-
- LPD880x (includes LPD8803, LPD8806, and others)
17
-
18
-
The WS2812 LED family is by far the most popular of these types, so this page will primarily focus on working with it.
19
-
20
-
Here you can see the RGB underglow feature in action using WS2812 LEDs.
To enable RGB underglow on your board or shield, simply enable the `CONFIG_ZMK_RGB_UNDERGLOW` and `CONFIG_*_STRIP` configuration values in the `.conf` file for your board or shield.
29
-
For example:
30
-
31
-
```ini
32
-
CONFIG_ZMK_RGB_UNDERGLOW=y
33
-
# Use the STRIP config specific to the LEDs you're using
34
-
CONFIG_WS2812_STRIP=y
35
-
```
36
-
37
-
See [Configuration Overview](/docs/config) for more instructions on how to use Kconfig.
38
-
39
-
If your board or shield does not have RGB underglow configured, refer to [Adding RGB Underglow to a Board](#adding-rgb-underglow-to-a-board).
40
-
41
-
### Modifying the Number of LEDs
42
-
43
-
The number of LEDs specified in the default configuration for your board or shield may not match the number you have installed. For example, the `corne` shield specifies only 10 LEDs per side while supporting up to 27. On a split keyboard, a good sign of this mismatch is if the lit LEDs on each half are symmetrical.
44
-
45
-
The `chain-length` property of the `led_strip` node controls the number of underglow LEDs. If it is incorrect for your build, [you can change this property](../config/index.md#changing-devicetree-properties) in your `<keyboard>.keymap` file by adding a stanza like this one outside of any other node (i.e. above or below the `/` node):
46
-
47
-
```dts
48
-
&led_strip {
49
-
chain-length = <21>;
50
-
};
51
-
```
52
-
53
-
For split keyboards, set `chain-length` to the number of LEDs installed on each half.
54
-
55
-
## Configuring RGB Underglow
56
-
57
-
See [RGB underglow configuration](/docs/config/underglow).
58
-
59
-
## Adding RGB Underglow to a Board
7
+
Please see [lighting feature page](../../../features/lighting.md#rgb-underglow) for an introduction on the feature.
60
8
61
9
Support for RGB underglow is always added to a board, not a shield. This is because the LED strip drivers rely on hardware-specific interfaces (e.g. SPI, I2S) and configurations, which shields do not control.
10
+
See the documentation page on [pin control](../pinctrl.mdx) for detailed information on setting up pins for hardware protocols such as SPI or PIO that are used for LED strips.
62
11
63
12
Shields written for boards which support RGB underglow should add a `boards/` folder underneath the shield folder. Inside this `boards/` folder, create a `<board>.overlay` for any of the boards the shield can be used with. Place all hardware-specific configurations in these `.overlay` files.
0 commit comments