Skip to content

Commit

Permalink
feat(shields): Add soft-off to the nrf52840dk ZMK Uno
Browse files Browse the repository at this point in the history
* Use Button 1 for soft off on the nrf52840 when using the ZMK Uno
  shield.
  • Loading branch information
petejohanson committed Dec 6, 2023
1 parent 3e14608 commit 845ac76
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
45 changes: 44 additions & 1 deletion app/boards/shields/zmk_uno/boards/nrf52840dk_nrf52840.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@
bias-pull-up;
};
};

qdec_sleep: qdec_sleep {
group1 {
psels = <NRF_PSEL(QDEC_A, 1, 11)>,
<NRF_PSEL(QDEC_B, 1, 10)>;
bias-pull-up;
low-power-enable;
};
};
};

// Set up the QDEC hardware based driver and give it the same label as the deleted node.
Expand All @@ -20,5 +29,39 @@ encoder: &qdec0 {
led-pre = <0>;
steps = <80>;
pinctrl-0 = <&qdec_default>;
pinctrl-names = "default";
pinctrl-1 = <&qdec_sleep>;
pinctrl-names = "default", "sleep";
};

/ {
behaviors {
soft_off: behavior_soft_off {
compatible = "zmk,behavior-soft-off";
#binding-cells = <0>;
label = "SOFT_OFF";
status = "okay";
};
};

wakeup_source: wakeup_source {
compatible = "zmk,wakeup-trigger-key";
status = "okay";

trigger = <&button0>;
wakeup-source;
};

soft_off_wakers {
compatible = "zmk,soft-off-wakeup-sources";
status = "okay";

wakeup-sources = <&wakeup_source>;
};

soft_off_behavior_key {
compatible = "zmk,behavior-key";
status = "okay";
bindings = <&soft_off>;
key = <&button0>;
};
};
4 changes: 4 additions & 0 deletions app/boards/shields/zmk_uno/zmk_uno.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ nice_view_spi: &arduino_spi {
compatible = "zmk,kscan-composite";
rows = <1>;
columns = <7>;
wakeup-source;

matrix {
kscan = <&kscan_matrix>;
Expand All @@ -110,6 +111,7 @@ nice_view_spi: &arduino_spi {
kscan_direct_comp: kscan_direct_comp {
compatible = "zmk,kscan-composite";
status = "disabled";
wakeup-source;

matrix {
kscan = <&kscan_direct>;
Expand All @@ -124,6 +126,7 @@ nice_view_spi: &arduino_spi {

kscan_matrix: kscan_matrix {
compatible = "zmk,kscan-gpio-matrix";
wakeup-source;

diode-direction = "col2row";

Expand All @@ -141,6 +144,7 @@ nice_view_spi: &arduino_spi {

kscan_direct: kscan_direct {
compatible = "zmk,kscan-gpio-direct";
wakeup-source;
status = "disabled";

input-gpios
Expand Down

0 comments on commit 845ac76

Please sign in to comment.