diff --git a/app/boards/arm/dogbone/Kconfig b/app/boards/arm/dogbone/Kconfig deleted file mode 100644 index a2c53d93..00000000 --- a/app/boards/arm/dogbone/Kconfig +++ /dev/null @@ -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) diff --git a/app/boards/arm/dogbone/Kconfig.board b/app/boards/arm/dogbone/Kconfig.board deleted file mode 100644 index 627e1259..00000000 --- a/app/boards/arm/dogbone/Kconfig.board +++ /dev/null @@ -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 diff --git a/app/boards/arm/dogbone/arduino_pro_micro_pins.dtsi b/app/boards/arm/dogbone/arduino_pro_micro_pins.dtsi deleted file mode 100644 index bfe1ac49..00000000 --- a/app/boards/arm/dogbone/arduino_pro_micro_pins.dtsi +++ /dev/null @@ -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 {}; diff --git a/app/boards/arm/dogbone/dogbone.dts b/app/boards/arm/dogbone/dogbone.dts deleted file mode 100644 index 044ce6f5..00000000 --- a/app/boards/arm/dogbone/dogbone.dts +++ /dev/null @@ -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)>; - }; -}; diff --git a/app/boards/arm/dogbone/dogbone.dtsi b/app/boards/arm/dogbone/dogbone.dtsi deleted file mode 100644 index 9bd23ff9..00000000 --- a/app/boards/arm/dogbone/dogbone.dtsi +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright (c) 2021 The ZMK Contributors - * - * SPDX-License-Identifier: MIT - */ - -#include -#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>; - }; - }; -}; diff --git a/app/boards/arm/dogbone/CMakeLists.txt b/app/boards/arm/s40nc/CMakeLists.txt similarity index 95% rename from app/boards/arm/dogbone/CMakeLists.txt rename to app/boards/arm/s40nc/CMakeLists.txt index 00952c30..f833ff2e 100644 --- a/app/boards/arm/dogbone/CMakeLists.txt +++ b/app/boards/arm/s40nc/CMakeLists.txt @@ -1,7 +1,7 @@ set_property(GLOBAL APPEND PROPERTY extra_post_build_commands COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py -c - -b 0x26000 + -b 0x1000 -f 0xADA52840 -o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2 ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin diff --git a/app/boards/arm/s40nc/Kconfig.board b/app/boards/arm/s40nc/Kconfig.board new file mode 100644 index 00000000..91b833dd --- /dev/null +++ b/app/boards/arm/s40nc/Kconfig.board @@ -0,0 +1,6 @@ +# Copyright (c) 2021 Kyle McCreery +# SPDX-License-Identifier: MIT + +config BOARD_S40NC + bool "S40NC" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/dogbone/Kconfig.defconfig b/app/boards/arm/s40nc/Kconfig.defconfig similarity index 68% rename from app/boards/arm/dogbone/Kconfig.defconfig rename to app/boards/arm/s40nc/Kconfig.defconfig index 76cc1ef5..366ac403 100644 --- a/app/boards/arm/dogbone/Kconfig.defconfig +++ b/app/boards/arm/s40nc/Kconfig.defconfig @@ -1,10 +1,10 @@ -# Copyright (c) 2021 The ZMK Contributors +# Copyright (c) 2021 Kyle McCreery # SPDX-License-Identifier: MIT -if BOARD_DOGBONE +if BOARD_S40NC -config BOARD - default "dogbone" +config ZMK_KEYBOARD_NAME + default "S40NC" if USB @@ -28,4 +28,4 @@ config ZMK_USB config ZMK_BATTERY_VOLTAGE_DIVIDER default y -endif # BOARD_DOGBONE +endif # BOARD_S40NC diff --git a/app/boards/arm/s40nc/README.md b/app/boards/arm/s40nc/README.md new file mode 100644 index 00000000..32db57e9 --- /dev/null +++ b/app/boards/arm/s40nc/README.md @@ -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 +``` diff --git a/app/boards/arm/dogbone/board.cmake b/app/boards/arm/s40nc/board.cmake similarity index 53% rename from app/boards/arm/dogbone/board.cmake rename to app/boards/arm/s40nc/board.cmake index fa847d50..ff67b133 100644 --- a/app/boards/arm/dogbone/board.cmake +++ b/app/boards/arm/s40nc/board.cmake @@ -1,5 +1,7 @@ +# Copyright (c) 2021 Kyle McCreery # SPDX-License-Identifier: MIT +set(OPENOCD_NRF5_SUBFAMILY nrf52) 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/openocd-nrf5.board.cmake) diff --git a/app/boards/arm/s40nc/s40nc.dts b/app/boards/arm/s40nc/s40nc.dts new file mode 100644 index 00000000..151ffcbe --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.dts @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2021 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include + +/ { + 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>; + }; + }; +}; diff --git a/app/boards/arm/s40nc/s40nc.keymap b/app/boards/arm/s40nc/s40nc.keymap new file mode 100644 index 00000000..5f5726c9 --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.keymap @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2021 Kyle McCreery + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +#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 < LOWER SPACE < CONTROL SPACE < 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 + >; + }; + }; +}; diff --git a/app/boards/arm/dogbone/dogbone.yaml b/app/boards/arm/s40nc/s40nc.yaml similarity index 74% rename from app/boards/arm/dogbone/dogbone.yaml rename to app/boards/arm/s40nc/s40nc.yaml index 663dafcb..1fb23ee3 100644 --- a/app/boards/arm/dogbone/dogbone.yaml +++ b/app/boards/arm/s40nc/s40nc.yaml @@ -1,11 +1,10 @@ -identifier: dogbone -name: dogbone +identifier: s40nc +name: S40NC type: mcu arch: arm toolchain: - zephyr - gnuarmemb - - xtools supported: - adc - usb_device diff --git a/app/boards/arm/s40nc/s40nc.zmk.yml b/app/boards/arm/s40nc/s40nc.zmk.yml new file mode 100644 index 00000000..57b30eca --- /dev/null +++ b/app/boards/arm/s40nc/s40nc.zmk.yml @@ -0,0 +1,11 @@ +file_format: "1" +id: s40nc +name: S40NC +type: board +arch: arm +features: + - keys +outputs: + - usb + - ble +url: https://mechwild.com diff --git a/app/boards/arm/dogbone/dogbone_defconfig b/app/boards/arm/s40nc/s40nc_defconfig similarity index 79% rename from app/boards/arm/dogbone/dogbone_defconfig rename to app/boards/arm/s40nc/s40nc_defconfig index 6f6a2dd5..c711d1f5 100644 --- a/app/boards/arm/dogbone/dogbone_defconfig +++ b/app/boards/arm/s40nc/s40nc_defconfig @@ -1,8 +1,9 @@ +# Copyright (c) 2021 Kyle McCreery # SPDX-License-Identifier: MIT CONFIG_SOC_SERIES_NRF52X=y CONFIG_SOC_NRF52840_QIAA=y -CONFIG_BOARD_DOGBONE=y +CONFIG_BOARD_S40NC=y # Enable MPU CONFIG_ARM_MPU=y @@ -17,4 +18,4 @@ CONFIG_NVS=y CONFIG_SETTINGS_NVS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y -CONFIG_FLASH_MAP=y \ No newline at end of file +CONFIG_FLASH_MAP=y