From 029a7eb9fca7cff7414185f8beffb204b9d1ed69 Mon Sep 17 00:00:00 2001 From: Bartosz Nowak Date: Sun, 25 Apr 2021 01:51:04 +0200 Subject: [PATCH] Adding dactyl manuform --- .../shields/dactyl_manuform/Kconfig.defconfig | 36 +++++++++++++ .../shields/dactyl_manuform/Kconfig.shield | 6 +++ app/boards/shields/dactyl_manuform/README.rst | 51 +++++++++++++++++++ .../boards/particle_xenon.overlay | 50 ++++++++++++++++++ .../boards/particle_xenon_deconfig | 16 ++++++ .../dactyl_manuform/dactyl_manuform.keymap | 27 ++++++++++ .../dactyl_manuform/dactyl_manuform.overlay | 51 +++++++++++++++++++ 7 files changed, 237 insertions(+) create mode 100644 app/boards/shields/dactyl_manuform/Kconfig.defconfig create mode 100644 app/boards/shields/dactyl_manuform/Kconfig.shield create mode 100644 app/boards/shields/dactyl_manuform/README.rst create mode 100644 app/boards/shields/dactyl_manuform/boards/particle_xenon.overlay create mode 100644 app/boards/shields/dactyl_manuform/boards/particle_xenon_deconfig create mode 100644 app/boards/shields/dactyl_manuform/dactyl_manuform.keymap create mode 100644 app/boards/shields/dactyl_manuform/dactyl_manuform.overlay diff --git a/app/boards/shields/dactyl_manuform/Kconfig.defconfig b/app/boards/shields/dactyl_manuform/Kconfig.defconfig new file mode 100644 index 00000000..5a25948d --- /dev/null +++ b/app/boards/shields/dactyl_manuform/Kconfig.defconfig @@ -0,0 +1,36 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_DACTYLMANUFORM + +config ZMK_KEYBOARD_NAME + default "dactyl_manuform" + +# TODO: MOVE TO PARTICLE BOARD +config BUILD_OUTPUT_UF2 + default y + +# TODO: MOVE TO PARTICLE BOARD +config FLASH_LOAD_OFFSET + default 0x26000 + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +# TODO: ADD SUPPORT FOR ZMK +# config ZMK_BATTERY_VOLTAGE_DIVIDER +# default y + +endif # SHIELD_DACTYLMANUFORM diff --git a/app/boards/shields/dactyl_manuform/Kconfig.shield b/app/boards/shields/dactyl_manuform/Kconfig.shield new file mode 100644 index 00000000..0b1cd03e --- /dev/null +++ b/app/boards/shields/dactyl_manuform/Kconfig.shield @@ -0,0 +1,6 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_DACTYLMANUFORM + def_bool $(shields_list_contains,dactyl_manuform) + diff --git a/app/boards/shields/dactyl_manuform/README.rst b/app/boards/shields/dactyl_manuform/README.rst new file mode 100644 index 00000000..5164b0e8 --- /dev/null +++ b/app/boards/shields/dactyl_manuform/README.rst @@ -0,0 +1,51 @@ +================= +Dactyl Manuform +================= + +This shield is basing on this project: +https://github.com/abstracthat/dactyl-manuform + +------------------- +Board +------------------- + +I ported the Dactyl Manuform, where instead of using Pro Pico board I picked Particle Xenon. +This board is quite cheap and easy to find in many stores. +Other supported boards was too pricy or unavailable in my country. + +^^^^^^^^^^^^^^^^^^^ +Bootloader +^^^^^^^^^^^^^^^^^^^ + +To make it works you need to flash your Particle with: +https://github.com/adafruit/Adafruit_nRF52_Bootloader + +Why Adafruit bootloader you may ask? + +* MCUBOOT: + This bootloader is hard to use and require installation of quite big amount of tools. +* Particle: + Default bootloader in other hands, require special version of nrftool and you need to use more then one button to trigger boot mode. + It should support binary generated here. +* Adafruit: + It has all MCUBOOT functionality and also support UF2 binary format. + +Here you can find the step by step tutorial how to flash it. +https://docs.particle.io/tutorials/learn-more/xenon-circuit-python/ +https://learn.adafruit.com/circuitpython-on-the-nrf52/nrf52840-bootloader + +------------------- +Building +------------------- + +west build -p auto -b particle_xenon -- -DSHIELD='dactyl_manuform' + +----------------------- +Flashing with Adafruit +----------------------- + +To flash device you need to trigger dfu mode on this bootloader. To do, so double click reset button. + +adafruit-nrfutil dfu genpkg --dev-type 0x0052 --application build/zephyr/zmk.hex dfu-package.zip + +adafruit-nrfutil dfu serial --package dfu-package.zip -p /dev/ttyACM0 -b 115200 diff --git a/app/boards/shields/dactyl_manuform/boards/particle_xenon.overlay b/app/boards/shields/dactyl_manuform/boards/particle_xenon.overlay new file mode 100644 index 00000000..741e836a --- /dev/null +++ b/app/boards/shields/dactyl_manuform/boards/particle_xenon.overlay @@ -0,0 +1,50 @@ +/delete-node/ &storage_partition; +/delete-node/ &boot_partition; + +adafriut_flash: &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>; + }; + + }; +}; + +/ { + chosen { + zephyr,flash = &adafriut_flash; + zephyr,code-partition = &code_partition; + }; +}; diff --git a/app/boards/shields/dactyl_manuform/boards/particle_xenon_deconfig b/app/boards/shields/dactyl_manuform/boards/particle_xenon_deconfig new file mode 100644 index 00000000..501fe699 --- /dev/null +++ b/app/boards/shields/dactyl_manuform/boards/particle_xenon_deconfig @@ -0,0 +1,16 @@ +# SPDX-License-Identifier: MIT + +# 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 diff --git a/app/boards/shields/dactyl_manuform/dactyl_manuform.keymap b/app/boards/shields/dactyl_manuform/dactyl_manuform.keymap new file mode 100644 index 00000000..f50206a6 --- /dev/null +++ b/app/boards/shields/dactyl_manuform/dactyl_manuform.keymap @@ -0,0 +1,27 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp W &kp E &kp R &kp T + &kp Q &kp S &kp D &kp F &kp G + &kp A &kp X &kp C &kp V &kp B + &kp Z &kp EQUAL &kp MINUS &kp SPACE &kp ESC + &kp LGUI &kp BSPC + &kp LCTRL &kp LALT + >; + }; + }; +}; \ No newline at end of file diff --git a/app/boards/shields/dactyl_manuform/dactyl_manuform.overlay b/app/boards/shields/dactyl_manuform/dactyl_manuform.overlay new file mode 100644 index 00000000..21347508 --- /dev/null +++ b/app/boards/shields/dactyl_manuform/dactyl_manuform.overlay @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2020 Bartosz Nowak + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <5>; + rows = <5>; + map = < + RC(0,1) RC(0,2) RC(0,3) RC(0,4) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) + RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) + RC(4,3) RC(4,4) + RC(4,1) RC(4,2) + + >; + }; + +// TODO: Switch form mesh_header to arduino header think of better way + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "row2col"; + row-gpios + = <&mesh_header 18 (GPIO_ACTIVE_HIGH)> + , <&mesh_header 17 (GPIO_ACTIVE_HIGH)> + , <&mesh_header 16 (GPIO_ACTIVE_HIGH)> + , <&mesh_header 15 (GPIO_ACTIVE_HIGH)> + , <&mesh_header 14 (GPIO_ACTIVE_HIGH)> + ; + + col-gpios + = <&mesh_header 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&mesh_header 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&mesh_header 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&mesh_header 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&mesh_header 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +};