Browse Source

feat(board): Add Ferris 0.2 boards

* Onboard stm32f072 with mcp23018 IO expander.
* No underglow support yet.
* Miryoku inspired default layout.
xmkb
Peter Johanson 3 years ago committed by Pete Johanson
parent
commit
e42590a049
  1. 8
      app/boards/arm/ferris/Kconfig.board
  2. 23
      app/boards/arm/ferris/Kconfig.defconfig
  3. 16
      app/boards/arm/ferris/README.md
  4. 7
      app/boards/arm/ferris/board.cmake
  5. 139
      app/boards/arm/ferris/ferris_rev02.dts
  6. 79
      app/boards/arm/ferris/ferris_rev02.keymap
  7. 12
      app/boards/arm/ferris/ferris_rev02.yaml
  8. 10
      app/boards/arm/ferris/ferris_rev02.zmk.yml
  9. 43
      app/boards/arm/ferris/ferris_rev02_defconfig

8
app/boards/arm/ferris/Kconfig.board

@ -0,0 +1,8 @@
# Ferris board configuration
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_FERRIS
bool "Ferris rev 0.2"
depends on SOC_STM32F072XB

23
app/boards/arm/ferris/Kconfig.defconfig

@ -0,0 +1,23 @@
# Ferris board configuration
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
if BOARD_FERRIS
config BOARD
default "ferris_rev02"
config ZMK_KEYBOARD_NAME
default "Ferris rev 0.2"
config ZMK_USB
default y
config ZMK_KSCAN_MATRIX_POLLING
default y
config ZMK_KSCAN_COMPOSITE_DRIVER
default y
endif # BOARD_FERRIS

16
app/boards/arm/ferris/README.md

@ -0,0 +1,16 @@
# Building ZMK for the Ferris 0.2
## Standard Build
```
west build -p -d build/ferris --board ferris_rev02
```
## Flashing
`west` can be used to flash the board directly. Press the reset button once, and run:
```
west flash -d build/ferris
```

7
app/boards/arm/ferris/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)

139
app/boards/arm/ferris/ferris_rev02.dts

@ -0,0 +1,139 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <st/f0/stm32f072Xb.dtsi>
#include <st/f0/stm32f072v(8-b)tx-pinctrl.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
model = "Ferris rev0.2";
compatible = "ferris,rev02", "st,stm32f072";
chosen {
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan;
zmk,matrix_transform = &transform;
/* TODO: Enable once we support the IC for underglow
zmk,underglow = &led_strip;
*/
};
transform: transform {
compatible = "zmk,matrix-transform";
rows = <4>;
columns = <10>;
map = <
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)
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)
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)
RC(3,3) RC(3,4) RC(3,5) RC(3,6)
>;
};
kscan: kscan {
compatible = "zmk,kscan-composite";
label = "KSCAN";
rows = <4>;
columns = <10>;
left {
kscan = <&kscan_left>;
};
right {
kscan = <&kscan_right>;
column-offset = <5>;
};
};
kscan_left: kscan_left {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN_LEFT";
diode-direction = "col2row";
col-gpios
= <&gpiob 8 (GPIO_ACTIVE_HIGH)>
, <&gpiob 4 (GPIO_ACTIVE_HIGH)>
, <&gpiob 3 (GPIO_ACTIVE_HIGH)>
, <&gpioa 15 (GPIO_ACTIVE_HIGH)>
, <&gpioa 14 (GPIO_ACTIVE_HIGH)>
;
row-gpios
= <&gpiob 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpiob 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpiob 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpioa 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
kscan_right: kscan_right {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN_RIGHT";
diode-direction = "row2col";
col-gpios
= <&right_io 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&right_io 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&right_io 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&right_io 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&right_io 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
row-gpios
= <&right_io 8 (GPIO_ACTIVE_LOW)>
, <&right_io 9 (GPIO_ACTIVE_LOW)>
, <&right_io 10 (GPIO_ACTIVE_LOW)>
, <&right_io 11 (GPIO_ACTIVE_LOW)>
;
};
};
&i2c2 {
pinctrl-0 = <&i2c2_scl_pb10 &i2c2_sda_pb11>;
status = "okay";
clock-frequency = <I2C_BITRATE_FAST>;
right_io: mcp23017@20 {
compatible = "microchip,mcp23017";
status = "okay";
gpio-controller;
reg = <0x20>;
label = "RIGHT_IO";
#gpio-cells = <2>;
ngpios = <16>;
};
};
&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>;
};
};
};

79
app/boards/arm/ferris/ferris_rev02.keymap

@ -0,0 +1,79 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#define NAV_L 1
#define OTHER_L 2
#define NUM_L 3
#define SYM_L 4
// Using layer taps on thumbs, having quick tap as well helps w/ repeating space/backspace
&lt { quick_tap_ms = <200>; };
/ {
behaviors {
hm: homerow_mods {
compatible = "zmk,behavior-hold-tap";
label = "homerow mods";
#binding-cells = <2>;
tapping_term_ms = <200>;
flavor = "tap-preferred";
bindings = <&kp>, <&kp>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&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
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
&lt NAV_L TAB &kp ENTER &lt NUM_L SPACE &lt SYM_L BKSP
>;
};
nav_layer {
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &kp LARW &kp DARW &kp UARW &kp RARW
&trans &trans &trans &trans &trans &trans &kp HOME &kp PG_DN &kp PG_UP &kp END
&trans &trans &kp ESC &kp DEL
>;
};
other_layer {
bindings = <
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &kp HOME &trans &trans &trans
&trans &trans &trans &trans
>;
};
num_layer {
bindings = <
&kp LBKT &kp N7 &kp N8 &kp N9 &kp RBKT &trans &trans &trans &trans &trans
&kp SEMI &kp N4 &kp N5 &kp N6 &kp EQUAL &trans &trans &trans &trans &trans
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp BSLH &trans &trans &trans &trans &trans
&kp N0 &kp MINUS &trans &trans
>;
};
sym_layer {
bindings = <
&kp LBRC &kp LS(N7) &kp LS(N8) &kp LS(N9) &kp RBRC &trans &trans &trans &trans &trans
&kp COLON &kp LS(N4) &kp LS(N5) &kp LS(N6) &kp PLUS &trans &trans &trans &trans &trans
&kp TILDE &kp LS(N1) &kp LS(N2) &kp LS(N3) &kp LS(BSLH) &trans &trans &trans &trans &trans
&kp LS(N0) &kp UNDER &trans &trans
>;
};
};
};

12
app/boards/arm/ferris/ferris_rev02.yaml

@ -0,0 +1,12 @@
identifier: ferris_rev02
name: Ferris 0.2
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
ram: 40
supported:
- switches
- underglow

10
app/boards/arm/ferris/ferris_rev02.zmk.yml

@ -0,0 +1,10 @@
file_format: "1"
id: ferris_rev02
name: Ferris 0.2
type: board
arch: arm
features:
- keys
outputs:
- usb
url: https://github.com/pierrechevalier83/ferris/tree/main/0.2

43
app/boards/arm/ferris/ferris_rev02_defconfig

@ -0,0 +1,43 @@
# SPDX-License-Identifier: MIT
CONFIG_BOARD_FERRIS=y
CONFIG_SOC_SERIES_STM32F0X=y
CONFIG_SOC_STM32F072XB=y
# 48MHz system clock
CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=48000000
# enable PINMUX
CONFIG_PINMUX=y
# enable GPIO
CONFIG_GPIO=y
# Enable i2c
CONFIG_I2C=y
# ZMK Settings
CONFIG_ZMK_USB=y
CONFIG_ZMK_KSCAN_GPIO_DRIVER=y
CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER=y
CONFIG_ZMK_KSCAN_MATRIX_POLLING=y
CONFIG_USB_SELF_POWERED=n
# Enable IO multiplexer
CONFIG_GPIO_MCP23017=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 48MHz clock at PLL output
# CONFIG_CLOCK_STM32_PLL_PREDIV=1
CONFIG_CLOCK_STM32_PLL_MULTIPLIER=6
CONFIG_CLOCK_STM32_AHB_PRESCALER=1
CONFIG_CLOCK_STM32_APB1_PRESCALER=1
# CONFIG_CLOCK_STM32_APB2_PRESCALER=1
Loading…
Cancel
Save