summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Johanson <peter@peterjohanson.com>2020-12-30 15:44:03 -0500
committerPete Johanson <peter@peterjohanson.com>2020-12-31 14:46:15 -0500
commit39490552f2a84282143e0ec039fdaf4b2f309539 (patch)
treef60cd83ada9111ed110e15537434f74bcf0dee4a
parent5072590af523cf25941e05945d490d350f148797 (diff)
feat(boards): Add BDN9 Rev2 board.
* Onboard stm32f072. * 3 possible encoder positions. * Underglow/per-key not yet support.
-rw-r--r--.github/workflows/build.yml1
-rw-r--r--app/boards/arm/bdn9/Kconfig.board8
-rw-r--r--app/boards/arm/bdn9/Kconfig.defconfig17
-rw-r--r--app/boards/arm/bdn9/README.md37
-rw-r--r--app/boards/arm/bdn9/bdn9_rev2.dts107
-rw-r--r--app/boards/arm/bdn9/bdn9_rev2.keymap38
-rw-r--r--app/boards/arm/bdn9/bdn9_rev2.yaml14
-rw-r--r--app/boards/arm/bdn9/bdn9_rev2_defconfig29
-rw-r--r--app/boards/arm/bdn9/board.cmake7
-rw-r--r--docs/docs/hardware.md1
10 files changed, 259 insertions, 0 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 0aee5d7..288a2de 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -57,6 +57,7 @@ jobs:
- tidbit
cmake-args: [""]
include:
+ - board: bdn9_rev2
- board: dz60rgb_rev1
- board: nrf52840_m2
shield: m60
diff --git a/app/boards/arm/bdn9/Kconfig.board b/app/boards/arm/bdn9/Kconfig.board
new file mode 100644
index 0000000..a67e9a5
--- /dev/null
+++ b/app/boards/arm/bdn9/Kconfig.board
@@ -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
diff --git a/app/boards/arm/bdn9/Kconfig.defconfig b/app/boards/arm/bdn9/Kconfig.defconfig
new file mode 100644
index 0000000..9af7ca4
--- /dev/null
+++ b/app/boards/arm/bdn9/Kconfig.defconfig
@@ -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
diff --git a/app/boards/arm/bdn9/README.md b/app/boards/arm/bdn9/README.md
new file mode 100644
index 0000000..7b4ef44
--- /dev/null
+++ b/app/boards/arm/bdn9/README.md
@@ -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>;
+```
diff --git a/app/boards/arm/bdn9/bdn9_rev2.dts b/app/boards/arm/bdn9/bdn9_rev2.dts
new file mode 100644
index 0000000..43854a1
--- /dev/null
+++ b/app/boards/arm/bdn9/bdn9_rev2.dts
@@ -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>;
+ };
+ };
+};
diff --git a/app/boards/arm/bdn9/bdn9_rev2.keymap b/app/boards/arm/bdn9/bdn9_rev2.keymap
new file mode 100644
index 0000000..50c273c
--- /dev/null
+++ b/app/boards/arm/bdn9/bdn9_rev2.keymap
@@ -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>;
+ */
+ };
+ };
+};
+
diff --git a/app/boards/arm/bdn9/bdn9_rev2.yaml b/app/boards/arm/bdn9/bdn9_rev2.yaml
new file mode 100644
index 0000000..bbae883
--- /dev/null
+++ b/app/boards/arm/bdn9/bdn9_rev2.yaml
@@ -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
diff --git a/app/boards/arm/bdn9/bdn9_rev2_defconfig b/app/boards/arm/bdn9/bdn9_rev2_defconfig
new file mode 100644
index 0000000..139cf85
--- /dev/null
+++ b/app/boards/arm/bdn9/bdn9_rev2_defconfig
@@ -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
diff --git a/app/boards/arm/bdn9/board.cmake b/app/boards/arm/bdn9/board.cmake
new file mode 100644
index 0000000..4f430e1
--- /dev/null
+++ b/app/boards/arm/bdn9/board.cmake
@@ -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)
diff --git a/docs/docs/hardware.md b/docs/docs/hardware.md
index 406b9ad..89761c4 100644
--- a/docs/docs/hardware.md
+++ b/docs/docs/hardware.md
@@ -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