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,31 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: |
Driver for a dedicated key triggered by matrix scanning for invoking a connected behavior.
compatible: "zmk,behavior-key-scanned"
include: base.yaml
properties:
key:
type: phandle
required: true
description: The GPIO key that triggers wake via interrupt
bindings:
type: phandle
required: true
description: The GPIO key that triggers wake via interrupt
debounce-press-ms:
type: int
default: 5
description: Debounce time for key press in milliseconds. Use 0 for eager debouncing.
debounce-release-ms:
type: int
default: 5
description: Debounce time for key release in milliseconds.
debounce-scan-period-ms:
type: int
default: 1
description: Time between reads in milliseconds when any key is pressed.

View File

@@ -0,0 +1,31 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: |
Driver for a dedicated key for invoking a connected behavior.
compatible: "zmk,behavior-key"
include: base.yaml
properties:
key:
type: phandle
required: true
description: The GPIO key that triggers wake via interrupt
bindings:
type: phandle
required: true
description: The GPIO key that triggers wake via interrupt
debounce-press-ms:
type: int
default: 5
description: Debounce time for key press in milliseconds. Use 0 for eager debouncing.
debounce-release-ms:
type: int
default: 5
description: Debounce time for key release in milliseconds.
debounce-scan-period-ms:
type: int
default: 1
description: Time between reads in milliseconds when any key is pressed.

View File

@@ -0,0 +1,14 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: |
Description of all possible wakeup-sources from a forces
soft-off state.
compatible: "zmk,soft-off-wakeup-sources"
properties:
wakeup-sources:
type: phandles
required: true
description: List of wakeup-sources that should be enabled to wake the system from forces soft-off state.

View File

@@ -0,0 +1,18 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
description: |
Driver for a dedicated key for waking the device from sleep
compatible: "zmk,wakeup-trigger-key"
include: base.yaml
properties:
trigger:
type: phandle
required: true
description: The GPIO key that triggers wake via interrupt
extra-gpios:
type: phandle-array
description: Optional set of pins that should be set active before sleeping.