refactor(shields): Updated ZMK Uno encoder config.

* Move to new steps/triggers-per-rotation config.
* Leverage QDEC Nordic driver when used on Nordic DK.
This commit is contained in:
Peter Johanson 2023-04-16 08:18:57 +00:00 committed by Pete Johanson
parent 621d946d29
commit f8aaaff556
2 changed files with 50 additions and 23 deletions

View file

@ -0,0 +1,24 @@
/ {
// 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;
};
};
};
// 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-names = "default";
};

View file

@ -165,15 +165,18 @@
encoder: encoder { encoder: encoder {
label = "ENCODER"; label = "ENCODER";
resolution = <4>; steps = <80>;
compatible = "alps,ec11"; compatible = "alps,ec11";
a-gpios = <&arduino_header 14 GPIO_PULL_UP>; a-gpios = <&arduino_header 15 GPIO_PULL_UP>;
b-gpios = <&arduino_header 15 GPIO_PULL_UP>; b-gpios = <&arduino_header 14 GPIO_PULL_UP>;
}; };
sensors { sensors {
compatible = "zmk,keymap-sensors"; compatible = "zmk,keymap-sensors";
sensors = <&encoder>; sensors = <&encoder>;
triggers-per-rotation = <20>;
left {
triggers-per-rotation = <20>;
};
}; };
}; };