Skip to content

Commit

Permalink
refactor(pm): Remove scanned behavior trigger.
Browse files Browse the repository at this point in the history
* Remove the painful scanned behavior trigger for now, future enhancement
  will restore this high level functionality using kscan directly.
  • Loading branch information
petejohanson committed Dec 30, 2023
1 parent 96cf77f commit 024ce83
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 236 deletions.
1 change: 0 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ target_sources(app PRIVATE src/sensors.c)
target_sources_ifdef(CONFIG_ZMK_WPM app PRIVATE src/wpm.c)
target_sources(app PRIVATE src/event_manager.c)
target_sources_ifdef(CONFIG_ZMK_GPIO_KEY_BEHAVIOR_TRIGGER app PRIVATE src/gpio_key_behavior_trigger.c)
target_sources_ifdef(CONFIG_ZMK_GPIO_SCANNED_KEY_BEHAVIOR_TRIGGER app PRIVATE src/gpio_scanned_key_behavior_trigger.c)
target_sources_ifdef(CONFIG_ZMK_PM app PRIVATE src/pm.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
target_sources_ifdef(CONFIG_ZMK_GPIO_KEY_WAKEUP_TRIGGER app PRIVATE src/gpio_key_wakeup_trigger.c)
Expand Down
5 changes: 0 additions & 5 deletions app/Kconfig.behaviors
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ config ZMK_GPIO_KEY_BEHAVIOR_TRIGGER
default y
depends on DT_HAS_ZMK_GPIO_KEY_BEHAVIOR_TRIGGER_ENABLED

config ZMK_GPIO_SCANNED_KEY_BEHAVIOR_TRIGGER
bool
default y
depends on DT_HAS_ZMK_GPIO_SCANNED_KEY_BEHAVIOR_TRIGGER_ENABLED

config ZMK_BEHAVIOR_KEY_TOGGLE
bool
default y
Expand Down
31 changes: 0 additions & 31 deletions app/dts/bindings/zmk,gpio-scanned-key-behavior-trigger.yaml

This file was deleted.

184 changes: 0 additions & 184 deletions app/src/gpio_scanned_key_behavior_trigger.c

This file was deleted.

17 changes: 2 additions & 15 deletions docs/docs/features/soft-off.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The simplest way to achieve this is with a push button between a GPIO pin and gr

#### Matrix-Integrated Hardware Combo

Another, more complicated option is to tie two of the switch outputs in the matrix together through an AND gate and connect that to the dedicated GPIO pin. This way you can use a key combination in your existing keyboard matrix to trigger soft on/off. To make this work best, the two switches used should both be driven by the same matrix input pin so that both will be active simultaneously on the AND gate inputs. The alternative is to use a combination of diodes and capacitors to ensure both pins are active/high at the same time even if scanning sets them high at different times.
Another, more complicated option is to tie two of the switch outputs in the matrix together through an AND gate and connect that to the dedicated GPIO pin. This way you can use a key combination in your existing keyboard matrix to trigger soft on/off. To make this work best, the two switches used should both be driven by the same matrix input pin so that both will be active simultaneously on the AND gate inputs. The alternative is to use a combination of diodes and capacitors to ensure both pins are active/high at the same time even if scanning sets them high at different times. Support for this mode will be coming soon.

### Firmware Changes

Expand Down Expand Up @@ -92,20 +92,7 @@ Here are the properties for the behavior key node:
- The `bindings` property is a phandle to the soft off behavior defined above.
- The `key` property is a phandle to the GPIO key defined earlier.

If you have set up your on/off to be controlled by a matrix-integrated combo, the behavior key needs use a different driver that will handle detecting the pressed state when the pin is toggled by the other matrix kscan driver:

```
/ {
soft_off_behavior_key {
compatible = "zmk,gpio-scanned-key-behavior-trigger";
status = "okay";
bindings = <&hw_soft_off>;
key = <&wakeup_key>;
};
};
```

Note that the only difference from the `soft_off_behavior_key` definition for GPIO keys above is the `compatible` value of `zmk,gpio-scanned-key-behavior-trigger`.
If you have set up your on/off to be controlled by a matrix-integrated combo, the behavior key will need to be integrated into your existing kscan setup. Full details to come when this is supported.

#### Wakeup Sources

Expand Down

0 comments on commit 024ce83

Please sign in to comment.