Skip to content

Commit

Permalink
feat(docs): Update power and lighting config pages
Browse files Browse the repository at this point in the history
Moved battery configuration to its own page to match the feature page.

Documented that external power is disabled when in sleep mode.

Clarified that the *_START configs apply on first boot, and any changes
after that are persisted.
  • Loading branch information
joelspadin authored and Aurel committed Feb 12, 2023
1 parent 9456acc commit 1a7012e
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 15 deletions.
4 changes: 4 additions & 0 deletions docs/docs/config/backlight.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ Definition file: [zmk/app/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/
| `CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE` | bool | Turn off backlight when keyboard goes into idle state | n |
| `CONFIG_ZMK_BACKLIGHT_AUTO_OFF_USB` | bool | Turn off backlight when USB is disconnected | n |

:::note
The `*_START` settings only determine the initial backlight state. Any changes you make with the [backlight behavior](../behaviors/backlight.md) are saved to flash after a one minute delay and will be used after that.
:::

## Devicetree

Applies to: [`/chosen` node](https://docs.zephyrproject.org/latest/build/dts/intro.html#aliases-and-chosen-nodes)
Expand Down
40 changes: 40 additions & 0 deletions docs/docs/config/battery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
title: Battery Level
sidebar_label: Battery Level
---

See the [battery level feature page](../features/battery.md) for more details on configuring a battery sensor.

See [Configuration Overview](index.md) for instructions on how to change these settings.

### Devicetree

Applies to: [`/chosen` node](https://docs.zephyrproject.org/latest/guides/dts/intro.html#aliases-and-chosen-nodes)

| Property | Type | Description |
| ------------- | ---- | --------------------------------------------- |
| `zmk,battery` | path | The node for the battery sensor driver to use |

## Battery Voltage Divider Sensor

Driver for reading the voltage of a battery using an ADC connected to a voltage divider.

### Devicetree

Applies to: `compatible = "zmk,battery-voltage-divider"`

See [Zephyr's voltage divider documentation](https://docs.zephyrproject.org/latest/build/dts/api/bindings/adc/voltage-divider.html).

## nRF VDDH Battery Sensor

Driver for reading the voltage of a battery using a Nordic nRF52's VDDH pin. This driver has no configuration except for the required `label` property.

### Devicetree

Applies to: `compatible = "zmk,battery-nrf-vddh"`

Definition file: [zmk/app/drivers/zephyr/dts/bindings/sensor/zmk,battery-nrf-vddh.yaml](https://github.com/zmkfirmware/zmk/blob/main/app/drivers/zephyr/dts/bindings/sensor/zmk%2Cbattery-nrf-vddh.yaml)

| Property | Type | Description |
| -------- | ------ | ------------------------- |
| `label` | string | Unique label for the node |
6 changes: 3 additions & 3 deletions docs/docs/config/behaviors.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,9 @@ See [dt-bindings/zmk/modifiers.h](https://github.com/zmkfirmware/zmk/blob/main/a

You can use the following nodes to tweak the default behaviors:

| Node | Behavior |
| -------- | ------------ |
| `&gresc` | Grave escape |
| Node | Behavior |
| -------- | ----------------------------------------- |
| `&gresc` | [Grave escape](../behaviors/mod-morph.md) |

## Sticky Key

Expand Down
12 changes: 1 addition & 11 deletions docs/docs/config/power.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Configuration for entering low power modes when the keyboard is idle.

In the idle state, peripherals such as displays and lighting are disabled, but the keyboard remains connected to Bluetooth so it can immediately respond when you press a key.

In the deep sleep state, the keyboard additionally disconnects from Bluetooth. This state uses very little power, but it may take a few seconds to reconnect after waking.
In the deep sleep state, the keyboard additionally disconnects from Bluetooth and any external power output is disabled. This state uses very little power, but it may take a few seconds to reconnect after waking.

### Kconfig

Expand Down Expand Up @@ -45,13 +45,3 @@ Applies to: `compatible = "zmk,ext-power-generic"`
| `label` | string | Unique label for the node |
| `control-gpios` | GPIO array | List of GPIOs which should be active to enable external power |
| `init-delay-ms` | int | number of milliseconds to delay after initializing the driver |

## Battery Voltage Divider

Driver for reading the voltage of a battery using an ADC connected to a voltage divider.

### Devicetree

Applies to: `compatible = "zmk,battery-voltage-divider"`

See [Zephyr's voltage divider documentation](https://docs.zephyrproject.org/latest/build/dts/api/bindings/adc/voltage-divider.html).
4 changes: 4 additions & 0 deletions docs/docs/config/underglow.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ Values for `CONFIG_ZMK_RGB_UNDERGLOW_EFF_START`:
| 2 | Spectrum |
| 3 | Swirl |

:::note
The `*_START` settings only determine the initial underglow state. Any changes you make with the [underglow behavior](../behaviors/underglow.md) are saved to flash after a one minute delay and will be used after that.
:::

## Devicetree

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).
Expand Down
2 changes: 2 additions & 0 deletions docs/docs/features/battery.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ To enable a battery sensor on a new board, add the driver for the sensor to your
- `zmk,battery-voltage-divider`: Reads the voltage on an analog input pin.
- `zmk,battery-nrf-vddh`: Reads the power supply voltage on a Nordic nRF52's VDDH pin.

See the [battery level configuration page](../config/battery.md) for the configuration supported by each driver provided by ZMK.

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.

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:
Expand Down
3 changes: 2 additions & 1 deletion docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,16 @@ module.exports = {
Configuration: [
"config/index",
"config/backlight",
"config/battery",
"config/behaviors",
"config/combos",
"config/displays",
"config/encoders",
"config/keymap",
"config/kscan",
"config/power",
"config/system",
"config/underglow",
"config/system",
],
Development: [
"development/clean-room",
Expand Down

0 comments on commit 1a7012e

Please sign in to comment.