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:
parent
621d946d29
commit
f8aaaff556
2 changed files with 50 additions and 23 deletions
|
@ -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";
|
||||||
|
};
|
|
@ -40,10 +40,10 @@
|
||||||
|
|
||||||
// Commented out until we add more powerful power domain support
|
// Commented out until we add more powerful power domain support
|
||||||
// external_power {
|
// external_power {
|
||||||
// compatible = "zmk,ext-power-generic";
|
// compatible = "zmk,ext-power-generic";
|
||||||
// label = "EXT_POWER";
|
// label = "EXT_POWER";
|
||||||
// init-delay-ms = <200>;
|
// init-delay-ms = <200>;
|
||||||
// control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
// control-gpios = <&arduino_header 1 GPIO_ACTIVE_LOW>;
|
||||||
// };
|
// };
|
||||||
|
|
||||||
rgb_power {
|
rgb_power {
|
||||||
|
@ -128,14 +128,14 @@
|
||||||
diode-direction = "col2row";
|
diode-direction = "col2row";
|
||||||
|
|
||||||
col-gpios
|
col-gpios
|
||||||
= <&arduino_header 10 GPIO_ACTIVE_HIGH>
|
= <&arduino_header 10 GPIO_ACTIVE_HIGH>
|
||||||
, <&arduino_header 9 GPIO_ACTIVE_HIGH>
|
, <&arduino_header 9 GPIO_ACTIVE_HIGH>
|
||||||
;
|
;
|
||||||
|
|
||||||
row-gpios
|
row-gpios
|
||||||
= <&arduino_header 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
= <&arduino_header 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
, <&arduino_header 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
, <&arduino_header 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||||
;
|
;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -144,11 +144,11 @@
|
||||||
status = "disabled";
|
status = "disabled";
|
||||||
|
|
||||||
input-gpios
|
input-gpios
|
||||||
= <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
= <&arduino_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
, <&arduino_header 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&arduino_header 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
, <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&arduino_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
, <&arduino_header 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&arduino_header 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
;
|
;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -157,23 +157,26 @@
|
||||||
toggle-mode;
|
toggle-mode;
|
||||||
|
|
||||||
input-gpios
|
input-gpios
|
||||||
= <&arduino_header 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
= <&arduino_header 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
, <&arduino_header 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&arduino_header 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
, <&arduino_header 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
, <&arduino_header 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
|
||||||
;
|
;
|
||||||
};
|
};
|
||||||
|
|
||||||
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>;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue