aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/dts
diff options
context:
space:
mode:
authorPeter Johanson <[email protected]>2023-03-15 21:48:30 -0400
committerPete Johanson <[email protected]>2024-03-27 20:59:26 -0700
commitadb3a13dc583e1876d5aa17da0ade4c1024cad7d (patch)
treee3cfcb746af8e65e3f8edf6d2ab0432d7a5d3db9 /app/dts
parent58ccc5970dc804857d81609857d4217278ec025c (diff)
downloadzmk-adb3a13dc583e1876d5aa17da0ade4c1024cad7d.tar.gz
zmk-adb3a13dc583e1876d5aa17da0ade4c1024cad7d.zip
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 <[email protected]>
Diffstat (limited to 'app/dts')
-rw-r--r--app/dts/behaviors.dtsi1
-rw-r--r--app/dts/behaviors/soft_off.dtsi15
-rw-r--r--app/dts/bindings/zmk,behavior-key-scanned.yaml31
-rw-r--r--app/dts/bindings/zmk,behavior-key.yaml31
-rw-r--r--app/dts/bindings/zmk,soft-off-wakeup-sources.yaml14
-rw-r--r--app/dts/bindings/zmk,wakeup-trigger-key.yaml18
6 files changed, 110 insertions, 0 deletions
diff --git a/app/dts/behaviors.dtsi b/app/dts/behaviors.dtsi
index 23f2fee280..fde7527189 100644
--- a/app/dts/behaviors.dtsi
+++ b/app/dts/behaviors.dtsi
@@ -20,3 +20,4 @@
#include <behaviors/backlight.dtsi>
#include <behaviors/macros.dtsi>
#include <behaviors/mouse_key_press.dtsi>
+#include <behaviors/soft_off.dtsi>
diff --git a/app/dts/behaviors/soft_off.dtsi b/app/dts/behaviors/soft_off.dtsi
new file mode 100644
index 0000000000..fa6571a111
--- /dev/null
+++ b/app/dts/behaviors/soft_off.dtsi
@@ -0,0 +1,15 @@
+/*
+ * Copyright (c) 2023 The ZMK Contributors
+ *
+ * SPDX-License-Identifier: MIT
+ */
+
+/ {
+ behaviors {
+ /omit-if-no-ref/ soft_off: behavior_soft_off {
+ compatible = "zmk,behavior-soft-off";
+ label = "SOFTOFF";
+ #binding-cells = <0>;
+ };
+ };
+};
diff --git a/app/dts/bindings/zmk,behavior-key-scanned.yaml b/app/dts/bindings/zmk,behavior-key-scanned.yaml
new file mode 100644
index 0000000000..bdb3abaff0
--- /dev/null
+++ b/app/dts/bindings/zmk,behavior-key-scanned.yaml
@@ -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.
diff --git a/app/dts/bindings/zmk,behavior-key.yaml b/app/dts/bindings/zmk,behavior-key.yaml
new file mode 100644
index 0000000000..ff7a585eaf
--- /dev/null
+++ b/app/dts/bindings/zmk,behavior-key.yaml
@@ -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.
diff --git a/app/dts/bindings/zmk,soft-off-wakeup-sources.yaml b/app/dts/bindings/zmk,soft-off-wakeup-sources.yaml
new file mode 100644
index 0000000000..f98039a0ca
--- /dev/null
+++ b/app/dts/bindings/zmk,soft-off-wakeup-sources.yaml
@@ -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.
diff --git a/app/dts/bindings/zmk,wakeup-trigger-key.yaml b/app/dts/bindings/zmk,wakeup-trigger-key.yaml
new file mode 100644
index 0000000000..fa7636d1f3
--- /dev/null
+++ b/app/dts/bindings/zmk,wakeup-trigger-key.yaml
@@ -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.