Skip to content

Commit

Permalink
fix(docs): Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Cem Aksoylar <[email protected]>
  • Loading branch information
petejohanson and caksoylar committed Dec 10, 2023
1 parent cf270be commit f62df55
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
8 changes: 7 additions & 1 deletion docs/docs/config/kscan.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Definition file: [zmk/app/module/dts/bindings/kscan/zmk,kscan-gpio-direct.yaml](
| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `CONFIG_ZMK_KSCAN_DIRECT_POLLING` is enabled. | 10 |
| `toggle-mode` | bool | Use toggle switch mode. | n |
| `wakeup-source` | bool | Mark this kscan instance as able to wake the keyboard from deep sleep | n |

By default, a switch will drain current through the internal pull up/down resistor whenever it is pressed. This is not ideal for a toggle switch, where the switch may be left in the "pressed" state for a long time. Enabling `toggle-mode` will make the driver flip between pull up and down as the switch is toggled to optimize for power.

Expand All @@ -89,6 +90,7 @@ Assuming the switches connect each GPIO pin to the ground, the [GPIO flags](http
```dts
kscan0: kscan {
compatible = "zmk,kscan-gpio-direct";
wakeup-source;
input-gpios
= <&pro_micro 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pro_micro 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
Expand Down Expand Up @@ -123,6 +125,7 @@ Definition file: [zmk/app/module/dts/bindings/kscan/zmk,kscan-gpio-matrix.yaml](
| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 |
| `diode-direction` | string | The direction of the matrix diodes | `"row2col"` |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `CONFIG_ZMK_KSCAN_MATRIX_POLLING` is enabled. | 10 |
| `wakeup-source` | bool | Mark this kscan instance as able to wake the keyboard from deep sleep | n |

The `diode-direction` property must be one of:

Expand All @@ -137,6 +140,7 @@ The output pins (e.g. columns for `col2row`) should have the flag `GPIO_ACTIVE_H
```dts
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
wakeup-source;
diode-direction = "col2row";
col-gpios
= <&pro_micro 4 GPIO_ACTIVE_HIGH>
Expand Down Expand Up @@ -177,6 +181,7 @@ Definition file: [zmk/app/module/dts/bindings/kscan/zmk,kscan-gpio-charlieplex.y
| `debounce-release-ms` | int | Debounce time for key release in milliseconds. | 5 |
| `debounce-scan-period-ms` | int | Time between reads in milliseconds when any key is pressed. | 1 |
| `poll-period-ms` | int | Time between reads in milliseconds when no key is pressed and `interrupt-gpois` is not set. | 10 |
| `wakeup-source` | bool | Mark this kscan instance as able to wake the keyboard from deep sleep | n |

Define the transform with a [matrix transform](#matrix-transform). The row is always the driven pin, and the column always the receiving pin (input to the controller).
For example, in `RC(5,0)` power flows from the 6th pin in `gpios` to the 1st pin in `gpios`.
Expand Down Expand Up @@ -450,7 +455,8 @@ Note that the entire addressable space does not need to be mapped.
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-charlieplex";
compatible = "zmk,kscan-gpio-charlieplex";k
wakeup-source;
interrupt-gpios = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN) >;
gpios
Expand Down
4 changes: 2 additions & 2 deletions docs/docs/config/power.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ Definition file: [zmk/app/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/

## Soft Off

The [soft off feature](../features/soft-off.md) allows turning the keyboard on/off from either dedicated hardware of using the [`&soft_off` behavior](../behaviors/soft-off.md) to turn off and a reset button to turn back on again.
The [soft off feature](../features/soft-off.md) allows turning the keyboard on/off from either dedicated hardware, or using the [`&soft_off` behavior](../behaviors/soft-off.md) to turn off and a reset button to turn back on again.

### Kconfig

Definition file: [zmk/app/Kconfig](https://github.com/zmkfirmware/zmk/blob/main/app/Kconfig)

| Config | Type | Description | Default |
| ------------------------ | ---- | ------------------------------------------------------------------- | ------- |
| `CONFIG_ZMK_PM_SOFT_OFF` | bool | Enable soft off functionality from the keymap of dedicated hardware | n |
| `CONFIG_ZMK_PM_SOFT_OFF` | bool | Enable soft off functionality from the keymap or dedicated hardware | n |

## External Power Control

Expand Down
7 changes: 3 additions & 4 deletions docs/docs/features/soft-off.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ Once powered off, the keyboard will only wake up when:

## Soft Off With Existing Designs

For existing designs, using soft off is as simple as placing the [Soft Off Behavior](../behaviors/soft-off.md) in your keymap and then invoking it. For splits, at least for now, you'll need to place it somewhere on each side of your keymap and trigger on both sides, starting from the peripheral side first.
For existing designs, using soft off is as simple as placing the [Soft Off Behavior](../behaviors/soft-off.md) in your keymap and then invoking it.

You can then wake up the keyboard by pressing the reset button once, and repeating this for each side for split keyboards.

## Adding Soft On/Off To New Designs
## Adding Dedicated Soft On/Off GPIO Pin To New Designs

### Hardware Design

Expand Down Expand Up @@ -71,10 +71,9 @@ In this case, we will be creating a dedicated instance of the [Soft Off Behavior
```
/ {
behaviors {
hw_soft_off: behavior_hw_soft_off {
hw_soft_off: hw_soft_off {
compatible = "zmk,behavior-soft-off";
#binding-cells = <0>;
label = "HW_SO";
hold-time-ms = <5000>;
};
};
Expand Down

0 comments on commit f62df55

Please sign in to comment.