* Better naming for gpio-key behavior triggers. * Tweaks to scanned behavior trigger to avoid bad semaphore use, and reduce chance of issues with slowly scanned matrixes. * Various code cleanups of style issues.
66 lines
No EOL
1.4 KiB
Text
66 lines
No EOL
1.4 KiB
Text
|
|
/ {
|
|
// First, delete the existing basic GPIO based instance.
|
|
/delete-node/ encoder;
|
|
};
|
|
|
|
&pinctrl {
|
|
qdec_default: qdec_default {
|
|
group1 {
|
|
psels = <NRF_PSEL(QDEC_A, 1, 11)>,
|
|
<NRF_PSEL(QDEC_B, 1, 10)>;
|
|
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.
|
|
encoder: &qdec0 {
|
|
status = "okay";
|
|
led-pre = <0>;
|
|
steps = <80>;
|
|
pinctrl-0 = <&qdec_default>;
|
|
pinctrl-1 = <&qdec_sleep>;
|
|
pinctrl-names = "default", "sleep";
|
|
};
|
|
|
|
/ {
|
|
behaviors {
|
|
soft_off: soft_off {
|
|
compatible = "zmk,behavior-soft-off";
|
|
#binding-cells = <0>;
|
|
status = "okay";
|
|
};
|
|
};
|
|
|
|
wakeup_source: wakeup_source {
|
|
compatible = "zmk,gpio-key-wakeup-trigger";
|
|
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,gpio-key-behavior-trigger";
|
|
status = "okay";
|
|
bindings = <&soft_off>;
|
|
key = <&button0>;
|
|
};
|
|
}; |