feat: Add soft on/off support.

Initial work on a soft on/off support for ZMK. Triggering soft off
puts the device into deep sleep with only a specific GPIO pin
configured to wake the device, avoiding waking from other key
presses in the matrix like the normal deep sleep.

Co-authored-by: Cem Aksoylar <caksoylar@users.noreply.github.com>
This commit is contained in:
Peter Johanson 2023-03-15 21:48:30 -04:00 committed by Pete Johanson
parent 58ccc5970d
commit adb3a13dc5
19 changed files with 852 additions and 0 deletions

View file

@ -0,0 +1,38 @@
---
title: Soft Off Behavior
sidebar_label: Soft Off
---
## Summary
The soft off behavior is used to force the keyboard into an off state. Depending on the specific keyboard hardware, the keyboard can be turned back on again either with a dedicated on/off button that is available, or using the reset button found on the device.
For more information, see the [Soft Off Feature](../features/soft-off.md) page.
### Behavior Binding
- Reference: `&soft_off`
Example:
```
&soft_off
```
### Configuration
#### Hold Time
By default, the keyboard will be turned off as soon as the key bound to the behavior is released, even if the key is only tapped briefly. If you would prefer that the key need be held a certain amount of time before releasing, you can set the `hold-time-ms` to a non-zero value in your keymap:
```
&soft_off {
hold-time-ms = <5000>; // Only turn off it the key is held for 5 seconds or longer.
};
/ {
keymap {
...
};
};
```