Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created September 1, 2021 14:06
Show Gist options
  • Save petejohanson/fb01112d09cdd05776f9b9838859b6ea to your computer and use it in GitHub Desktop.
Save petejohanson/fb01112d09cdd05776f9b9838859b6ea to your computer and use it in GitHub Desktop.
Zephyr level shifter GPIO abstraction
/dts-v1/
/ {
shifter: 74hc595a@0 {
compatible = "ti,xx74hc595a";
a-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
b-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
c-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
}
kscan: kscan0 {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "col2row";
col-gpios =
<&shifter 0 GPIO_ACTIVE_HIGH>,
<&shifter 1 GPIO_ACTIVE_HIGH>,
<&shifter 2 GPIO_ACTIVE_HIGH>,
<&shifter 3 GPIO_ACTIVE_HIGH>,
<&shifter 4 GPIO_ACTIVE_HIGH>
;
row-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH GPIO_PULL_DOWN>;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment