Skip to content

Commit 9a49f39

Browse files
committed
feat(boards): Add initial Ferris 0.2 board definition.
* Onboard stm32f072, mcp23017 expander. * Underglow not yet supported. * Keymap is Miryoku inspired, but for less thumbs
1 parent f22fed5 commit 9a49f39

File tree

11 files changed

+373
-0
lines changed

11 files changed

+373
-0
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
include:
6565
- board: bdn9_rev2
6666
- board: dz60rgb_rev1
67+
- board: ferris_rev02
6768
- board: nrf52840_m2
6869
shield: m60
6970
- board: planck_rev6
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: Apache-2.0
2+
3+
if(CONFIG_PINMUX)
4+
zephyr_library()
5+
zephyr_library_sources(pinmux.c)
6+
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
7+
endif()
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Ferris board configuration
2+
3+
# Copyright (c) 2020 The ZMK Contributors
4+
# SPDX-License-Identifier: MIT
5+
6+
config BOARD_FERRIS
7+
bool "Ferris rev 0.2"
8+
depends on SOC_STM32F072XB
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Ferris board configuration
2+
3+
# Copyright (c) 2020 The ZMK Contributors
4+
# SPDX-License-Identifier: MIT
5+
6+
if BOARD_FERRIS
7+
8+
config BOARD
9+
default "ferris_rev02"
10+
11+
config ZMK_KEYBOARD_NAME
12+
default "Ferris rev 0.2"
13+
14+
config ZMK_USB
15+
default y
16+
17+
config ZMK_KSCAN_MATRIX_POLLING
18+
default y
19+
20+
config ZMK_KSCAN_COMPOSITE_DRIVER
21+
default y
22+
23+
endif # BOARD_FERRIS

app/boards/arm/ferris/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Building ZMK for the Ferris 0.2
2+
3+
4+
## Standard Build
5+
6+
```
7+
west build -p -d build/ferris --board ferris_rev02
8+
```
9+
10+
## Flashing
11+
12+
`west` can be used to flash the board directly. Press the reset button once, and run:
13+
14+
```
15+
west flash -d build/ferris
16+
```

app/boards/arm/ferris/board.cmake

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
board_runner_args(dfu-util "--pid=0483:df11" "--alt=0" "--dfuse")
4+
board_runner_args(jlink "--device=STM32F072CB" "--speed=4000")
5+
6+
include(${ZEPHYR_BASE}/boards/common/dfu-util.board.cmake)
7+
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
/*
2+
* Copyright (c) 2020 The ZMK Contributors
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
/dts-v1/;
8+
#include <st/f0/stm32f072Xb.dtsi>
9+
10+
#include <dt-bindings/zmk/matrix_transform.h>
11+
12+
/ {
13+
model = "Ferris rev0.2";
14+
compatible = "ferris,rev02", "st,stm32f072";
15+
16+
chosen {
17+
zephyr,sram = &sram0;
18+
zephyr,flash = &flash0;
19+
zmk,kscan = &kscan;
20+
zmk,matrix_transform = &transform;
21+
/* TODO: Enable once we support the IC for underglow
22+
zmk,underglow = &led_strip;
23+
*/
24+
};
25+
26+
transform: transform {
27+
compatible = "zmk,matrix-transform";
28+
rows = <4>;
29+
columns = <10>;
30+
31+
map = <
32+
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9)
33+
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9)
34+
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9)
35+
RC(3,3) RC(3,4) RC(3,5) RC(3,6)
36+
>;
37+
};
38+
39+
kscan: kscan {
40+
compatible = "zmk,kscan-composite";
41+
label = "KSCAN";
42+
rows = <4>;
43+
columns = <10>;
44+
45+
left {
46+
kscan = <&kscan_left>;
47+
};
48+
49+
right {
50+
kscan = <&kscan_right>;
51+
column-offset = <5>;
52+
};
53+
};
54+
55+
kscan_left: kscan_left {
56+
compatible = "zmk,kscan-gpio-matrix";
57+
label = "KSCAN_LEFT";
58+
59+
diode-direction = "col2row";
60+
61+
col-gpios
62+
= <&gpiob 8 (GPIO_ACTIVE_HIGH)>
63+
, <&gpiob 4 (GPIO_ACTIVE_HIGH)>
64+
, <&gpiob 3 (GPIO_ACTIVE_HIGH)>
65+
, <&gpioa 15 (GPIO_ACTIVE_HIGH)>
66+
, <&gpioa 14 (GPIO_ACTIVE_HIGH)>
67+
;
68+
row-gpios
69+
= <&gpiob 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
70+
, <&gpiob 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
71+
, <&gpiob 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
72+
, <&gpioa 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
73+
;
74+
};
75+
76+
kscan_right: kscan_right {
77+
compatible = "zmk,kscan-gpio-matrix";
78+
label = "KSCAN_RIGHT";
79+
80+
diode-direction = "row2col";
81+
82+
col-gpios
83+
= <&right_io 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
84+
, <&right_io 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
85+
, <&right_io 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
86+
, <&right_io 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
87+
, <&right_io 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
88+
;
89+
row-gpios
90+
= <&right_io 8 (GPIO_ACTIVE_LOW)>
91+
, <&right_io 9 (GPIO_ACTIVE_LOW)>
92+
, <&right_io 10 (GPIO_ACTIVE_LOW)>
93+
, <&right_io 11 (GPIO_ACTIVE_LOW)>
94+
;
95+
};
96+
};
97+
98+
&i2c2 {
99+
status = "okay";
100+
clock-frequency = <I2C_BITRATE_FAST>;
101+
102+
right_io: mcp23017@20 {
103+
compatible = "microchip,mcp23017";
104+
status = "okay";
105+
gpio-controller;
106+
reg = <0x20>;
107+
label = "RIGHT_IO";
108+
#gpio-cells = <2>;
109+
ngpios = <16>;
110+
};
111+
};
112+
113+
&usb {
114+
status = "okay";
115+
};
116+
117+
&rtc {
118+
status = "okay";
119+
};
120+
121+
&flash0 {
122+
/*
123+
* For more information, see:
124+
* http://docs.zephyrproject.org/latest/guides/dts/index.html#flash-partitions
125+
*/
126+
partitions {
127+
compatible = "fixed-partitions";
128+
#address-cells = <1>;
129+
#size-cells = <1>;
130+
131+
/* Set 6Kb of storage at the end of the 128Kb of flash */
132+
storage_partition: partition@3e800 {
133+
label = "storage";
134+
reg = <0x0001e800 0x00001800>;
135+
};
136+
};
137+
};
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
/*
2+
* Copyright (c) 2020 The ZMK Contributors
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*/
6+
7+
#include <behaviors.dtsi>
8+
#include <dt-bindings/zmk/keys.h>
9+
#include <dt-bindings/zmk/bt.h>
10+
11+
#define NAV_L 1
12+
#define OTHER_L 2
13+
#define NUM_L 3
14+
#define SYM_L 4
15+
16+
// Using layer taps on thumbs, having quick tap as well helps w/ repeating space/backspace
17+
&lt { quick_tap_ms = <200>; };
18+
19+
/ {
20+
behaviors {
21+
hm: homerow_mods {
22+
compatible = "zmk,behavior-hold-tap";
23+
label = "homerow mods";
24+
#binding-cells = <2>;
25+
tapping_term_ms = <200>;
26+
flavor = "tap-preferred";
27+
bindings = <&kp>, <&kp>;
28+
};
29+
};
30+
31+
keymap {
32+
compatible = "zmk,keymap";
33+
34+
default_layer {
35+
bindings = <
36+
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
37+
&hm LGUI A &hm LALT S &hm LCTRL D &hm LSHFT F &kp G &kp H &hm RSHFT J &hm RCTRL K &hm LALT L &hm LGUI QUOT
38+
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
39+
&lt NAV_L TAB &kp ENTER &lt NUM_L SPACE &lt SYM_L BKSP
40+
>;
41+
};
42+
43+
nav_layer {
44+
bindings = <
45+
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
46+
&trans &trans &trans &trans &trans &trans &kp LARW &kp DARW &kp UARW &kp RARW
47+
&trans &trans &trans &trans &trans &trans &kp HOME &kp PG_DN &kp PG_UP &kp END
48+
&trans &trans &kp ESC &kp DEL
49+
>;
50+
};
51+
52+
other_layer {
53+
bindings = <
54+
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
55+
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
56+
&trans &trans &trans &trans &trans &trans &kp HOME &trans &trans &trans
57+
&trans &trans &trans &trans
58+
>;
59+
};
60+
61+
num_layer {
62+
bindings = <
63+
&kp LBKT &kp N7 &kp N8 &kp N9 &kp RBKT &trans &trans &trans &trans &trans
64+
&kp SEMI &kp N4 &kp N5 &kp N6 &kp EQUAL &trans &trans &trans &trans &trans
65+
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp BSLH &trans &trans &trans &trans &trans
66+
&kp N0 &kp MINUS &trans &trans
67+
>;
68+
};
69+
70+
sym_layer {
71+
bindings = <
72+
&kp LBRC &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp RBRC &trans &trans &trans &trans &trans
73+
&kp COLON &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp PLUS &trans &trans &trans &trans &trans
74+
&kp TILDE &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(BSLH) &trans &trans &trans &trans &trans
75+
&kp LS(N0) &kp UNDER &trans &trans
76+
>;
77+
};
78+
};
79+
};
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
identifier: ferris_rev02
2+
name: Ferris 0.2
3+
type: mcu
4+
arch: arm
5+
toolchain:
6+
- zephyr
7+
- gnuarmemb
8+
- xtools
9+
ram: 40
10+
supported:
11+
- switches
12+
- underglow
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# SPDX-License-Identifier: MIT
2+
3+
CONFIG_BOARD_FERRIS=y
4+
CONFIG_SOC_SERIES_STM32F0X=y
5+
CONFIG_SOC_STM32F072XB=y
6+
# 48MHz system clock
7+
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
8+
9+
# enable PINMUX
10+
CONFIG_PINMUX=y
11+
12+
# enable GPIO
13+
CONFIG_GPIO=y
14+
15+
# Enable i2c
16+
CONFIG_I2C=y
17+
18+
# ZMK Settings
19+
CONFIG_ZMK_USB=y
20+
CONFIG_ZMK_KSCAN_GPIO_DRIVER=y
21+
CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y
22+
CONFIG_ZMK_KSCAN_MATRIX_POLLING=y
23+
CONFIG_USB_SELF_POWERED=n
24+
25+
# Enable IO multiplexer
26+
CONFIG_GPIO_MCP23017=y
27+
28+
# Needed to reduce this to size that will fit on F072
29+
CONFIG_HEAP_MEM_POOL_SIZE=1024
30+
31+
# clock configuration
32+
CONFIG_CLOCK_CONTROL=y
33+
34+
# Clock configuration for Cube Clock control driver
35+
CONFIG_CLOCK_STM32_SYSCLK_SRC_PLL=y
36+
# use HSI as PLL input
37+
CONFIG_CLOCK_STM32_PLL_SRC_HSI=y
38+
# produce 48MHz clock at PLL output
39+
# CONFIG_CLOCK_STM32_PLL_PREDIV=1
40+
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=6
41+
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
42+
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
43+
# CONFIG_CLOCK_STM32_APB2_PRESCALER=1

0 commit comments

Comments
 (0)