aboutsummaryrefslogtreecommitdiffhomepage
path: root/app/boards/arm/glove80/glove80_rh.dts
blob: cc8104c7d9a1008d56182ad526db172a191e4bda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/*
 * Copyright (c) 2021 The ZMK Contributors
 *
 * SPDX-License-Identifier: MIT
 */


#include "glove80.dtsi"
#include "glove80_rh-pinctrl.dtsi"

#include <dt-bindings/led/led.h>

/ {
    model = "glove80_rh";
    compatible = "glove80_rh";

    chosen {
        zmk,underglow = &led_strip;
        zmk,backlight = &back_led_backlight;
        zmk,battery   = &vbatt;
    };

    back_led_backlight: pwmleds {
        compatible = "pwm-leds";
        pwm_led_0 {
            pwms = <&pwm0 0 PWM_USEC(20) PWM_POLARITY_NORMAL>;
        };
    };

    // Node name must match original "EXT_POWER" label to preserve user settings.
    EXT_POWER {
        compatible = "zmk,ext-power-generic";
        control-gpios = <&gpio0 19 GPIO_ACTIVE_HIGH>; /* WS2812_CE */
        init-delay-ms = <100>;
    };

    vbatt: vbatt {
        compatible = "zmk,battery-nrf-vddh";
    };
};

&spi3 {
    compatible = "nordic,nrf-spim";
    status = "okay";

    pinctrl-0 = <&spi3_default>;
    pinctrl-1 = <&spi3_sleep>;
    pinctrl-names = "default", "sleep";

    led_strip: ws2812@0 {
        compatible = "worldsemi,ws2812-spi";

        /* SPI */
        reg = <0>; /* ignored, but necessary for SPI bindings */
        spi-max-frequency = <4000000>;

        /* WS2812 */
        chain-length = <40>; /* 40 keys have underglow at the moment */
        spi-one-frame = <0x70>;
        spi-zero-frame = <0x40>;

        color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
    };
};

&pwm0 {
    status = "okay";
    pinctrl-0 = <&pwm0_default>;
    pinctrl-1 = <&pwm0_sleep>;
    pinctrl-names = "default", "sleep";
};


&uart0 {
    compatible = "nordic,nrf-uarte";
    pinctrl-0 = <&uart0_default>;
    pinctrl-1 = <&uart0_sleep>;
    pinctrl-names = "default", "sleep";
};

/* For right hand, the columns are offset by 7 */
&matrix_transform0 {
    col-offset = <7>;
};

&kscan0 {
    row-gpios
        = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW1
        , <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW2
        , <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW3
        , <&gpio1 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW4
        , <&gpio0 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW5
        , <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // RH ROW6
        ;
    col-gpios
        = <&gpio1 6 GPIO_ACTIVE_HIGH> // RH Thumb
        , <&gpio1 4 GPIO_ACTIVE_HIGH> // RH COL1
        , <&gpio0 2 GPIO_ACTIVE_HIGH> // RH COL2
        , <&gpio1 7 GPIO_ACTIVE_HIGH> // RH COL3
        , <&gpio1 5 GPIO_ACTIVE_HIGH> // RH COL4
        , <&gpio1 3 GPIO_ACTIVE_HIGH> // RH COL5
        , <&gpio1 1 GPIO_ACTIVE_HIGH> // RH COL6
        ;
};