Preparing S40NC for PR

This commit is contained in:
Kyle McCreery 2021-11-09 14:16:13 -05:00
parent e19deea62b
commit 4b96569086
15 changed files with 236 additions and 203 deletions

View file

@ -1,7 +0,0 @@
# SPDX-License-Identifier: MIT
config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on (BOARD_DOGBONE)

View file

@ -1,8 +0,0 @@
# dogbone board configuration
# Copyright (c) 2021 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_DOGBONE
bool "dogbone"
depends on SOC_NRF52840_QIAA

View file

@ -1,52 +0,0 @@
/*
* Copyright (c) 2021 The ZMK Contributors
*
* 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 &gpio1 14 0> /* D0 */
, <1 0 &gpio1 12 0> /* D1 */
, <2 0 &gpio0 25 0> /* D2 */
, <3 0 &gpio0 11 0> /* D3 */
, <4 0 &gpio1 8 0> /* D4/A6 */
, <5 0 &gpio0 27 0> /* D5 */
, <6 0 &gpio0 8 0> /* D6/A7 */
, <7 0 &gpio0 6 0> /* D7 */
, <8 0 &gpio0 31 0> /* D8/A8 */
, <9 0 &gpio0 26 0> /* D9/A9 */
, <10 0 &gpio0 29 0> /* D10/A10 */
, <16 0 &gpio0 28 0> /* D16 */
, <14 0 &gpio0 2 0> /* D14 */
, <15 0 &gpio0 3 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 &gpio1 15 0> /* A0 */
, <1 0 &gpio1 13 0> /* A1 */
, <2 0 &gpio1 10 0> /* A2 */
, <3 0 &gpio1 11 0> /* A3 */
, <6 0 &gpio1 8 0> /* D4/A6 */
, <7 0 &gpio0 8 0> /* D6/A7 */
, <8 0 &gpio0 31 0> /* D8/A8 */
, <9 0 &gpio0 26 0> /* D9/A9 */
, <10 0 &gpio0 29 0> /* D10/A10 */
;
};
};
pro_micro_i2c: &i2c0 {};
pro_micro_spi: &spi0 {};
pro_micro_serial: &uart0 {};

View file

@ -1,24 +0,0 @@
/*
* Copyright (c) 2021 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include "dogbone.dtsi"
/ {
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
};
vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 820000)>;
};
};

View file

@ -1,100 +0,0 @@
/*
* Copyright (c) 2021 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_pro_micro_pins.dtsi"
/ {
model = "dogbone";
compatible = "dogbone";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <25>;
scl-pin = <11>;
};
&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <46>;
rx-pin = <44>;
};
&usbd {
status = "okay";
};
&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

@ -1,7 +1,7 @@
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
-c -c
-b 0x26000 -b 0x1000
-f 0xADA52840 -f 0xADA52840
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 -o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin

View file

@ -0,0 +1,6 @@
# Copyright (c) 2021 Kyle McCreery
# SPDX-License-Identifier: MIT
config BOARD_S40NC
bool "S40NC"
depends on SOC_NRF52840_QIAA

View file

@ -1,10 +1,10 @@
# Copyright (c) 2021 The ZMK Contributors # Copyright (c) 2021 Kyle McCreery
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
if BOARD_DOGBONE if BOARD_S40NC
config BOARD config ZMK_KEYBOARD_NAME
default "dogbone" default "S40NC"
if USB if USB
@ -28,4 +28,4 @@ config ZMK_USB
config ZMK_BATTERY_VOLTAGE_DIVIDER config ZMK_BATTERY_VOLTAGE_DIVIDER
default y default y
endif # BOARD_DOGBONE endif # BOARD_S40NC

View file

@ -0,0 +1,9 @@
# S40NC
![S40NC](https://i.imgur.com/fk8587n.jpg)
Shorty40NoCordy (S40NC) is a limited run 40% bluetooth keyboard originally made and sold by MechWild.
## Building S40NC ZMK firmware
```
west build -p -b s40nc
```

View file

@ -1,5 +1,7 @@
# Copyright (c) 2021 Kyle McCreery
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
set(OPENOCD_NRF5_SUBFAMILY nrf52)
board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)

View file

@ -0,0 +1,139 @@
/*
* Copyright (c) 2021 Kyle McCreery
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/zmk/matrix_transform.h>
/ {
model = "S40NC";
compatible = "s40nc";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
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,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(0,10) RC(0,11)
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(1,11)
RC(2,0) 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(2,10) RC(2,11)
RC(3,0) RC(3,1) RC(3,2) RC(3,4) RC(3,6) RC(3,8) RC(3,9) RC(3,10) RC(3,11)
>;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&gpio1 2 GPIO_ACTIVE_HIGH>
, <&gpio1 1 GPIO_ACTIVE_HIGH>
, <&gpio1 3 GPIO_ACTIVE_HIGH>
, <&gpio1 0 GPIO_ACTIVE_HIGH>
, <&gpio0 22 GPIO_ACTIVE_HIGH>
, <&gpio1 15 GPIO_ACTIVE_HIGH>
, <&gpio0 3 GPIO_ACTIVE_HIGH>
, <&gpio0 2 GPIO_ACTIVE_HIGH>
, <&gpio0 28 GPIO_ACTIVE_HIGH>
, <&gpio0 29 GPIO_ACTIVE_HIGH>
, <&gpio0 30 GPIO_ACTIVE_HIGH>
, <&gpio0 31 GPIO_ACTIVE_HIGH>
;
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio0 21 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 820000)>;
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&usbd {
status = "okay";
};
&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 = "mbr";
reg = <0x00000000 0x00001000>;
};
code_partition: partition@1000 {
label = "code_partition";
reg = <0x00001000 0x000d3000>;
};
/*
* The flash starting at 0x000d4000 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@d4000 {
label = "storage";
reg = <0x000d4000 0x00020000>;
};
boot_partition: partition@f4000 {
label = "adafruit_boot";
reg = <0x000f4000 0x0000c000>;
};
};
};

View file

@ -0,0 +1,57 @@
/*
* Copyright (c) 2021 Kyle McCreery
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#define DEFAULT 0
#define LOWER 1
#define RAISE 2
#define CONTROL 3
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp ESC &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&mo LOWER &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp ENTER
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp FSLH &kp UP &kp RSHFT
&kp LCTRL &kp LGUI &kp LALT &lt LOWER SPACE &lt CONTROL SPACE &lt RAISE SPACE &kp LEFT &kp DOWN &kp RIGHT
>;
};
lower_layer {
bindings = <
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp DEL
&kp PSCRN &kp MINUS &kp EQUAL &trans &trans &trans &trans &kp LBKT &kp RBKT &kp SEMI &kp APOS
&trans &trans &trans &trans &trans &trans &trans &kp COMMA &kp DOT &kp PG_UP &kp BSLH
&trans &trans &trans &kp TAB &kp TAB &kp TAB &kp HOME &kp PG_DN &kp END
>;
};
raise_layer {
bindings = <
&kp TILDE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &trans
&kp PSCRN &kp UNDER &kp PLUS &trans &trans &trans &trans &kp LBRC &kp RBRC &kp COLON &kp DQT
&trans &trans &trans &trans &trans &trans &trans &kp LT &kp GT &kp PG_UP &kp PIPE
&trans &trans &trans &kp TAB &kp TAB &kp TAB &kp HOME &kp PG_DN &kp END
>;
};
control_layer {
bindings = <
&bt BT_CLR &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp C_PP
&bt BT_SEL 0 &kp F11 &kp F12 &trans &trans &trans &trans &trans &trans &trans &kp K_LOCK
&bt BT_SEL 2 &out OUT_USB &kp CAPS &kp KP_NUM &kp SLCK &trans &trans &kp COMMA &kp DOT &kp K_VOL_UP &kp K_MUTE
&bt BT_SEL 3 &out OUT_BLE &kp PAUSE_BREAK &reset &trans &bootloader &kp C_BRI_DN &kp K_VOL_DN &kp C_BRI_UP
>;
};
};
};

View file

@ -1,11 +1,10 @@
identifier: dogbone identifier: s40nc
name: dogbone name: S40NC
type: mcu type: mcu
arch: arm arch: arm
toolchain: toolchain:
- zephyr - zephyr
- gnuarmemb - gnuarmemb
- xtools
supported: supported:
- adc - adc
- usb_device - usb_device

View file

@ -0,0 +1,11 @@
file_format: "1"
id: s40nc
name: S40NC
type: board
arch: arm
features:
- keys
outputs:
- usb
- ble
url: https://mechwild.com

View file

@ -1,8 +1,9 @@
# Copyright (c) 2021 Kyle McCreery
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_DOGBONE=y CONFIG_BOARD_S40NC=y
# Enable MPU # Enable MPU
CONFIG_ARM_MPU=y CONFIG_ARM_MPU=y
@ -17,4 +18,4 @@ CONFIG_NVS=y
CONFIG_SETTINGS_NVS=y CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y CONFIG_FLASH_MAP=y