Skip to content

Commit

Permalink
Merge pull request #1 from PolarityWorks/bt60-tsangan
Browse files Browse the repository at this point in the history
Bt60 tsangan
  • Loading branch information
wreckdump authored Aug 22, 2024
2 parents 9a5804d + a6a0731 commit 0c4f2e7
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 38 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ jobs:
name: Build
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Cache west modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-zephyr-modules
with:
Expand Down Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Rename zmk.uf2
run: cp build/zephyr/zmk.uf2 bt60.uf2
- name: Archive (bt60)
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: firmware
path: bt60.uf2
53 changes: 19 additions & 34 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 All @@ -23,12 +25,12 @@
zmk,backlight = &backlight;
zmk,matrix_transform = &default_transform;
zmk,battery = &vbatt;
zephyr,console = &cdc_acm_uart;
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
triggers-per-rotation = <10>;
};

default_transform: keymap_transform_0 {
Expand All @@ -47,7 +49,6 @@

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

col-gpios
Expand Down Expand Up @@ -87,31 +88,30 @@
label = "ENCODER_ONE";
a-gpios = <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <24>;
status = "okay";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
label = "ENCODER_TWO";
a-gpios = <&gpio0 26 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <24>;
status = "okay";
};
encoder_3: encoder_3 {
compatible = "alps,ec11";
label = "encoder_3";
a-gpios = <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
steps = <24>;
status = "okay";
};
backlight: pwmleds {
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 @@ -138,7 +138,9 @@

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

&gpiote {
Expand All @@ -153,24 +155,8 @@
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";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};


Expand Down Expand Up @@ -214,28 +200,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;
};
};
};
1 change: 0 additions & 1 deletion config/bt60.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
/ {
keymap {
compatible = "zmk,keymap";

default_layer {
// ------------------------------------------------------------------------------------------
// | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | BKSP |
Expand Down

0 comments on commit 0c4f2e7

Please sign in to comment.