Bringup sparkfun pro nrf52840 mini and pockettype

This commit is contained in:
KemoNine 2020-12-21 17:12:11 +00:00
parent 23e974da7d
commit 88dde6b577
18 changed files with 392 additions and 3 deletions

View File

@ -14,6 +14,8 @@ west build --board nice_nano -d build/lily58/left -- -DSHIELD=lily58_left -DZMK_
west build --board nice_nano -d build/lily58/right -- -DSHIELD=lily58_right -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
west build --board nice_nano -d build/pockettype -- -DSHIELD=pockettype -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
west build --board itsybitsy_nrf52840 -d build/azarashi64/left -- -DSHIELD=azarashi64_left -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config
west build --board itsybitsy_nrf52840 -d build/azarashi64/right -- -DSHIELD=azarashi64_right -DZMK_CONFIG=/workspaces/zmk-config/keyboards/zmk-config/config

View File

@ -0,0 +1,13 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
-c
-b 0x26000
-f 0xADA52840
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
)

View File

@ -0,0 +1,10 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_SPARKFUN_PRO_NRF52840_MINI

View File

@ -0,0 +1,9 @@
# Maker Diary nrf52840 M.2 board configuration
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
config BOARD_SPARKFUN_PRO_NRF52840_MINI
bool "sparkfun_pro_nrf52840_mini"
depends on SOC_NRF52840_QIAA

View File

@ -0,0 +1,30 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
if BOARD_SPARKFUN_PRO_NRF52840_MINI
config BOARD
default "sparkfun_pro_nrf52840_mini"
if USB
config USB_NRFX
default y
config USB_DEVICE_STACK
default y
endif # USB
config BT_CTLR
default BT
config ZMK_BLE
default y
config ZMK_USB
default y
endif # BOARD_SPARKFUN_PRO_NRF52840_MINI

View File

@ -0,0 +1,3 @@
# Sparkfun Pro nrf52840 Mini
https://www.sparkfun.com/products/15025

View File

@ -0,0 +1,51 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/
/ {
pro_micro_d: connector_d {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 15 0> /* D0 */
, <1 0 &gpio0 17 0> /* D1 */
, <3 0 &gpio0 19 0> /* D3 */
, <4 0 &gpio0 20 0> /* D4/A6 */
, <5 0 &gpio0 21 0> /* D5 */
, <6 0 &gpio0 22 0> /* D6/A7 */
, <7 0 &gpio0 23 0> /* D7 */
, <8 0 &gpio0 9 0> /* D8/A8 */
, <9 0 &gpio0 10 0> /* D9/A9 */
, <10 0 &gpio0 2 0> /* D10/A10 */
, <16 0 &gpio0 3 0> /* D16 */
, <14 0 &gpio0 31 0> /* D14 */
, <15 0 &gpio0 30 0> /* D15 */
;
};
pro_micro_a: connector_a {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 29 0> /* A0 */
, <1 0 &gpio0 28 0> /* A1 */
, <2 0 &gpio0 5 0> /* A2 */
, <3 0 &gpio0 4 0> /* A3 */
, <6 0 &gpio0 20 0> /* D4/A6 */
, <7 0 &gpio0 22 0> /* D6/A7 */
, <8 0 &gpio1 9 0> /* D8/A8 */
, <9 0 &gpio1 10 0> /* D9/A9 */
, <10 0 &gpio0 2 0> /* D10/A10 */
;
};
};
pro_micro_i2c: &i2c0 {};
pro_micro_spi: &spi0 {};
pro_micro_serial: &uart0 {};

View File

@ -0,0 +1,9 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)

View File

@ -0,0 +1,104 @@
/*
* Copyright (c) 2020 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_pro_micro_pins.dtsi"
/ {
model = "Sparkfun Pro nrf52840 Mini MCU";
compatible = "sparkfun,sparkfun_pro_nrf52840_mini";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
blue_led: led_2 {
gpios = <&gpio0 7 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
tx-pin = <17>;
rx-pin = <15>;
};
&usbd {
compatible = "nordic,nrf-usbd";
status = "okay";
};
&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <8>;
scl-pin = <11>;
};
&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;
sd_partition: partition@0 {
label = "softdevice";
reg = <0x00000000 0x00026000>;
};
code_partition: partition@26000 {
label = "code_partition";
reg = <0x00026000 0x000c6000>;
};
/*
* The flash starting at 0x000ec000 and ending at
* 0x000f3fff is reserved for use by the application.
*/
/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@ec000 {
label = "storage";
reg = <0x000ec000 0x00008000>;
};
boot_partition: partition@f4000 {
label = "adafruit_boot";
reg = <0x000f4000 0x0000c000>;
};
};
};

View File

@ -0,0 +1,15 @@
identifier: sparkfun_pro_nrf52840_mini
name: Sparkfun Pro nrf52840 Mini MCU
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View File

@ -0,0 +1,23 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_SPARKFUN_PRO_NRF52840_MINI=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

View File

@ -0,0 +1,9 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_POCKETTYPE
config ZMK_KEYBOARD_NAME
default "Pockettype!"
endif

View File

@ -0,0 +1,5 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_POCKETTYPE
def_bool $(shields_list_contains,pockettype)

View File

@ -0,0 +1,5 @@
# PocketType!
Standard setup for the [PocketType!](https://mechboards.co.uk/shop/kits/pockettype/) mini keyboard.
The `keymap` directory contains the keyboard layout and were created by [Keyboard Layout Editor](http://www.keyboard-layout-editor.com/). Please note: the zmk keymap is slightly adjusted from the default shown on the main PocketType! pages and QMK.

View File

@ -0,0 +1,42 @@
/*
* 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>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp ESCAPE &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp TAB &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp ENTER
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp SQT &kp RSHFT
&kp LCTRL &kp LGUI &kp LALT &kp CAPS &mo 1 &kp DEL &kp SPACE &mo 2 &kp LEFT &kp UP &kp DOWN &kp RIGHT
>;
};
lower_layer {
bindings = <
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL
&trans &trans &trans &trans &trans &trans &trans &kp LBKT &kp RBKT &kp SLASH &kp BSLH &kp PIPE
&bt BT_CLR &bt BT_PRV &bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &bootloader &reset
>;
};
raise_layer {
bindings = <
&kp PRINTSCREEN &trans &trans &trans &trans &trans &trans &kp PG_UP &kp UP &kp PG_DN &trans &trans
&trans &trans &trans &trans &trans &trans &kp HOME &kp LEFT &kp DOWN &kp RIGHT &kp END &trans
&kp LC(Z) &kp LC(X) &kp LC(C) &kp LC(V) &trans &trans &trans &trans &trans &kp C_VOL_UP &kp C_VOL_DN &kp C_PP
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
>;
};
};
};

View File

@ -0,0 +1,59 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix-transform.h>
// TODO: LEDs
// pro micro A3
// pro micro A2
/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};
default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;
map = <
RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0) RC(0,0)
RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0) RC(1,0)
RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0) RC(2,0)
RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0) RC(3,0)
>;
};
kscan0: kscan_0 {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
col-gpios
= <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_a 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 16 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 10 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 8 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 7 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 5 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 4 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 3 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 0 GPIO_ACTIVE_HIGH>
;
row-gpios
= <&pro_micro_d 1 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 6 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 9 GPIO_ACTIVE_HIGH>
;
};
};

View File

@ -37,7 +37,7 @@
compatible = "zmk,keymap";
default_layer {
bindings = <
&to 1 &bootloader &none
&tog 1 &bootloader &none
&none &none &none &kp LC(LA(TAB))
&none &none &none &kp LG(DOWN_ARROW)
&kp ESCAPE &none &none &none
@ -48,7 +48,7 @@
};
num_pad_layer {
bindings = <
&to 2 &kp KP_NUMLOCK &kp KP_SLASH
&tog 2 &kp KP_NUMLOCK &kp KP_SLASH
&kp KP_NUMBER_7 &kp KP_NUMBER_8 &kp KP_NUMBER_9 &kp KP_ASTERISK
&kp KP_NUMBER_4 &kp KP_NUMBER_5 &kp KP_NUMBER_6 &kp KP_MINUS
&kp KP_NUMBER_1 &kp KP_NUMBER_2 &kp KP_NUMBER_3 &kp KP_PLUS
@ -60,7 +60,7 @@
func_layer {
bindings = <
&to 0 &reset &bootloader
&tog 0 &reset &bootloader
&out OUT_TOG &out OUT_USB &out OUT_BLE &none
&rgb_ug RGB_TOG &bt BT_PRV &bt BT_NXT &bt BT_CLR
&ext_power EXT_POWER_TOGGLE_CMD &bt BT_SEL 4 &bt BT_SEL 5 &bt BT_SEL 6