feat(boards): Add BDN9 Rev2 board.

* Onboard stm32f072.
* 3 possible encoder positions.
* Underglow/per-key not yet support.
This commit is contained in:
Pete Johanson 2020-12-30 15:44:03 -05:00
parent 5072590af5
commit 39490552f2
10 changed files with 259 additions and 0 deletions

View file

@ -57,6 +57,7 @@ jobs:
- tidbit
cmake-args: [""]
include:
- board: bdn9_rev2
- board: dz60rgb_rev1
- board: nrf52840_m2
shield: m60

View file

@ -0,0 +1,8 @@
# keeb.io BDN9 board configuration
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_BDN9
bool "BDN9 rev2"
depends on SOC_STM32F072XB

View file

@ -0,0 +1,17 @@
# keeb.io BDN9 board configuration
# Copyright (c) 2020 Pete Johanson
# SPDX-License-Identifier: MIT
if BOARD_BDN9
config BOARD
default "bdn9_rev2"
config ZMK_KEYBOARD_NAME
default "BDN9 Rev2"
config ZMK_USB
default y
endif # BOARD_BDN9

View file

@ -0,0 +1,37 @@
# Building ZMK for the BDN9
Some general notes/commands for building standard BDN9 layouts from the assembly documentation.
## Standard Build
```
west build -p -d build/bdn9 --board bdn9_rev2
```
## Encoder Notes
If you built your BDN9 with encoders, you'll need to change the following in your local BDN9 config or add them to the end of the file.
```
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
```
Then, you'll want to uncomment the necessary encoder lines in your `bdn9_rev2.keymap`:
```
&sensors {
status = "okay";
sensors = <&left_encoder &mid_encoder &right_encoder>;
};
&left_encoder { status = "okay"; };
&mid_encoder { status = "okay"; };
&right_encoder { status = "okay"; };
```
And then add the correct `sensor-bindings` array to each keymap layer, e.g.:
```
sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp M_VOLU M_VOLD &inc_dec_kp C_PREV C_NEXT>;
```

View file

@ -0,0 +1,107 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <st/f0/stm32f072Xb.dtsi>
/ {
model = "Keeb.io BDN9 rev2";
compatible = "keebio,bdn9", "st,stm32f072";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan;
/* TODO: Enable once the GPIO bitbanging driver supports STM32
zmk,underglow = &led_strip;
*/
};
kscan: kscan {
compatible = "zmk,kscan-gpio-direct";
label = "KSCAN";
input-gpios
= <&gpiob 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiob 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiob 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiob 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiob 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiob 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpioa 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiof 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpiof 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};
/*
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";
a-gpios = <&gpioa 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpioa 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
mid_encoder: encoder_mid {
compatible = "alps,ec11";
label = "MID_ENCODER";
a-gpios = <&gpioa 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpioa 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
right_encoder: encoder_right {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&gpioa 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpiob 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "disabled";
};
sensors: sensors {
compatible = "zmk,keymap-sensors";
status = "disabled";
sensors = <>;
};
};
&usb {
status = "okay";
};
&rtc {
status = "okay";
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
/* Set 6Kb of storage at the end of the 128Kb of flash */
storage_partition: partition@3e800 {
label = "storage";
reg = <0x0001e800 0x00001800>;
};
};
};

View file

@ -0,0 +1,38 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
/* Uncomment and keep whatever encoders are on your BDN9
&sensors {
status = "okay";
sensors = <&left_encoder &mid_encoder &right_encoder>;
};
*/
// Uncomment each encoder installed on your BDN9
// &left_encoder { status = "okay"; };
// &mid_encoder { status = "okay"; };
// &right_encoder { status = "okay"; };
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp HOME &kp K_PP &kp END
&kp PG_UP &kp UP &kp PG_DN
&kp LEFT &kp DOWN &kp RIGHT
>;
/* Uncomment and add necessary bindings. This examples is for one encoder
sensor-bindings = <&inc_dec_kp PG_UP PG_DN>;
*/
};
};
};

View file

@ -0,0 +1,14 @@
identifier: bdn9
name: keeb.io BDN9
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 40
supported:
- encoders
- switches
- underglow
- per_key

View file

@ -0,0 +1,29 @@
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_STM32F0X=y
CONFIG_SOC_STM32F072XB=y
# 72MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=72000000
# Floating Point Options
CONFIG_FPU=y
# enable GPIO
CONFIG_GPIO=y
# Needed to reduce this to size that will fit on F072
CONFIG_HEAP_MEM_POOL_SIZE=1024
# clock configuration
CONFIG_CLOCK_CONTROL=y
# Clock configuration for Cube Clock control driver
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
# use HSI as PLL input
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
# produce 72MHz clock at PLL output
CONFIG_CLOCK_STM32_PLL_PREDIV=1
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=12
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=2
CONFIG_CLOCK_STM32_APB2_PRESCALER=1

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
board_runner_args(jlink "--device=STM32F072CB" "--speed=4000")
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)

View file

@ -19,6 +19,7 @@ That being said, there are currently only a few specific [boards](/docs/faq#what
- [nrfMicro](https://github.com/joric/nrfmicro) (`nrfmicro_13`, `nrfmicro_11`, `nrfmicro_11_flipped`)
- [BlueMicro840](https://store.jpconstantineau.com/#/group/bluemicro) (`bluemicro840_v1`)
- [QMK Proton-C](https://qmk.fm/proton-c/) (`proton_c`)
- [BDN9 Rev2](https://keeb.io/products/bdn9-rev-2-3x3-9-key-macropad-rotary-encoder-and-rgb) (`bdn9_rev2`)
## Keyboard Shields