Skip to content

Commit

Permalink
Add Pinctrl functions, change reset to sys_reset
Browse files Browse the repository at this point in the history
  • Loading branch information
ReFil committed Apr 9, 2023
1 parent b05d15f commit 47f47cd
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 27 deletions.
41 changes: 15 additions & 26 deletions config/boards/arm/bt60/bt60.dts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
#include <dt-bindings/led/led.h>
#include <dt-bindings/zmk/matrix_transform.h>

#include "pinctrl.dtsi"

/ {
model = "BT60";
compatible = "polarityworks,bt60v2";
Expand Down Expand Up @@ -46,7 +48,6 @@

kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";

col-gpios
Expand Down Expand Up @@ -109,8 +110,7 @@
compatible = "pwm-leds";
label = "Backlight LEDs";
pwm_led_0 {
pwms = <&pwm0 17>;
label = "Backlight LED 0";
pwms = <&pwm0 0 10000 PWM_POLARITY_NORMAL>;
};
};

Expand All @@ -137,7 +137,9 @@

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

&gpiote {
Expand All @@ -152,18 +154,6 @@
status = "okay";
};

&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <17>;
scl-pin = <20>;
};

&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <6>;
rx-pin = <8>;
};

&usbd {
status = "okay";
};
Expand Down Expand Up @@ -209,28 +199,27 @@
};
};

&spi1 {
&spi3 {
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";
status = "okay";
mosi-pin = <20>;
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
sck-pin = <27>;
miso-pin = <8>;
rx-delay-supported;
rx-delay = < 0x2 >;

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

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

/* WS2812 */
chain-length = <12>; /* number of LEDs */
chain-length = <12>; /* LED strip length */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};
3 changes: 3 additions & 0 deletions config/boards/arm/bt60/bt60_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y

CONFIG_PINCTRL=y

# encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
Expand All @@ -23,6 +25,7 @@ CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

CONFIG_SPI=y
CONFIG_ZMK_RGB_UNDERGLOW=y
CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
Expand Down
30 changes: 30 additions & 0 deletions config/boards/arm/bt60/pinctrl.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2022 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 20)>;
low-power-enable;
};
};
pwm0_default: pwm0_default {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
};
};
pwm0_sleep: pwm0_sleep {
group1 {
psels = <NRF_PSEL(PWM_OUT0, 0, 17)>;
low-power-enable;
};
};
};
2 changes: 1 addition & 1 deletion config/bt60.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
&trans &trans &kp UP &trans &trans &trans &trans &trans &kp INS &trans &kp PSCRN &kp SLCK &kp PAUSE_BREAK &rgb_ug RGB_TOG
&kp CAPS &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp HOME &kp PG_UP &bootloader
&kp C_PREV &kp C_VOL_DN &kp C_VOL_UP &kp C_MUTE &bl BL_INC &bl BL_DEC &trans &trans &trans &kp END &kp PG_DN &bl BL_TOG
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &reset &bt BT_CLR
&bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &sys_reset &bt BT_CLR
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
Expand Down

0 comments on commit 47f47cd

Please sign in to comment.