From 22c487f2767b6eaed14366379f6c3a07687ab6de Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Fri, 8 Apr 2022 01:59:19 +0000 Subject: [PATCH] feat(boards): Add BDN9 rev2 RGB support --- app/boards/arm/bdn9/Kconfig.defconfig | 6 ++++- app/boards/arm/bdn9/bdn9_rev2.conf | 5 ++++ app/boards/arm/bdn9/bdn9_rev2.dts | 35 +++++++++++++++++---------- 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 app/boards/arm/bdn9/bdn9_rev2.conf diff --git a/app/boards/arm/bdn9/Kconfig.defconfig b/app/boards/arm/bdn9/Kconfig.defconfig index 9af7ca4c..17695185 100644 --- a/app/boards/arm/bdn9/Kconfig.defconfig +++ b/app/boards/arm/bdn9/Kconfig.defconfig @@ -1,6 +1,6 @@ # keeb.io BDN9 board configuration -# Copyright (c) 2020 Pete Johanson +# Copyright (c) 2020 The ZMK Contributors # SPDX-License-Identifier: MIT if BOARD_BDN9 @@ -14,4 +14,8 @@ config ZMK_KEYBOARD_NAME config ZMK_USB default y +config ZMK_RGB_UNDERGLOW + select SPI + select WS2812_STRIP + endif # BOARD_BDN9 diff --git a/app/boards/arm/bdn9/bdn9_rev2.conf b/app/boards/arm/bdn9/bdn9_rev2.conf new file mode 100644 index 00000000..36910853 --- /dev/null +++ b/app/boards/arm/bdn9/bdn9_rev2.conf @@ -0,0 +1,5 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Uncomment the line below to enable RGB. +# CONFIG_ZMK_RGB_UNDERGLOW=y diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts index a28a3ae5..8a66be07 100644 --- a/app/boards/arm/bdn9/bdn9_rev2.dts +++ b/app/boards/arm/bdn9/bdn9_rev2.dts @@ -18,9 +18,7 @@ zephyr,flash = &flash0; zephyr,console = &cdc_acm_uart; zmk,kscan = &kscan; - /* TODO: Enable once the GPIO bitbanging driver supports STM32 zmk,underglow = &led_strip; - */ }; kscan: kscan { @@ -40,17 +38,6 @@ ; }; - /* - led_strip: ws2812 { - compatible = "worldsemi,ws2812-gpio"; - label = "WS2812"; - - in-gpios = <&gpiob 15 0>; - - chain-length = <9>; - }; - */ - left_encoder: encoder_left { compatible = "alps,ec11"; label = "LEFT_ENCODER"; @@ -83,6 +70,28 @@ }; }; +&spi2 { + status = "okay"; + pinctrl-0 = <&spi2_sck_pb13 &spi2_miso_pb14 &spi2_mosi_pb15>; + pinctrl-names = "default"; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <9>; + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + &clk_hsi { status = "okay"; };