zmk/app/boards/shields/sugarglider/sugarglider.overlay
2022-10-18 10:06:50 -04:00

124 lines
3.6 KiB
Text

/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "row2col";
debounce-scan-period-ms = <10>;
row-gpios
= <&ext_gpio 14 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 15 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 6 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 7 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 2 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 4 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 5 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 1 (GPIO_ACTIVE_LOW)>
, <&ext_gpio 3 (GPIO_ACTIVE_LOW)>
;
col-gpios
= <&ext_gpio 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&ext_gpio 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&ext_gpio 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&ext_gpio 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&ext_gpio 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&ext_gpio 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <6>;
rows = <9>;
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(8,0) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(8,5) RC(8,1) RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(8,2) RC(6,0) RC(6,1) RC(6,2) RC(6,3) RC(6,4) RC(6,5)
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(7,0) RC(7,1) RC(7,2) RC(7,3) RC(7,4) RC(7,5)
>;
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&blackpill 38 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&blackpill 39 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
label = "Encoder 2";
a-gpios = <&blackpill 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&blackpill 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
encoder_3: encoder_3 {
compatible = "alps,ec11";
label = "Encoder 3";
a-gpios = <&blackpill 45 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&blackpill 46 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
encoder_4: encoder_4 {
compatible = "alps,ec11";
label = "Encoder 4";
a-gpios = <&blackpill 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&blackpill 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <2>;
status = "disabled";
};
};
&spi1 {
cs-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>;
};
&i2c0 {
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
ext_gpio: mcp230xx@20 {
compatible = "microchip,mcp230xx";
status = "okay";
gpio-controller;
reg = <0x20>;
label = "EXT_GPIO";
#gpio-cells = <2>;
ngpios = <16>;
};
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
status = "okay";
reg = <0x3c>;
label = "DISPLAY";
width = <128>;
height = <64>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <63>;
prechargep = <0x22>;
};
};