diff --git a/app/boards/arm/cyber60/CMakeLists.txt b/app/boards/arm/cyber60/CMakeLists.txt new file mode 100644 index 00000000..00952c30 --- /dev/null +++ b/app/boards/arm/cyber60/CMakeLists.txt @@ -0,0 +1,8 @@ +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 +) diff --git a/app/boards/arm/cyber60/Kconfig.board b/app/boards/arm/cyber60/Kconfig.board new file mode 100644 index 00000000..83344f2e --- /dev/null +++ b/app/boards/arm/cyber60/Kconfig.board @@ -0,0 +1,9 @@ +# cyber60 board configuration + +# Copyright (c) 2020 Stefan Sundin (4pplet) +# SPDX-License-Identifier: MIT + +config BOARD_CYBER60_A + bool "cyber60 Rev A" + depends on SOC_NRF52840_QIAA + diff --git a/app/boards/arm/cyber60/Kconfig.defconfig b/app/boards/arm/cyber60/Kconfig.defconfig new file mode 100644 index 00000000..e53db746 --- /dev/null +++ b/app/boards/arm/cyber60/Kconfig.defconfig @@ -0,0 +1,31 @@ +# Copyright (c) 2020 Stefan Sundin (4pplet) +# SPDX-License-Identifier: MIT + +if BOARD_CYBER60_A + +config BOARD + default "cyber60 Rev A" + +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 + +config ZMK_BATTERY_VOLTAGE_DIVIDER + default y + +endif # BOARD_CYBER60_A diff --git a/app/boards/arm/cyber60/board.cmake b/app/boards/arm/cyber60/board.cmake new file mode 100644 index 00000000..fa847d50 --- /dev/null +++ b/app/boards/arm/cyber60/board.cmake @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: MIT + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/app/boards/arm/cyber60/cyber60.dts b/app/boards/arm/cyber60/cyber60.dts new file mode 100644 index 00000000..929dec82 --- /dev/null +++ b/app/boards/arm/cyber60/cyber60.dts @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2020 Stefan Sundin (4pplet) + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include +/ { + model = "CYBER60_A"; + compatible = "cyber60", "Rev A"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; +/* + vbat-sense-en { + label = "VBAT_SENSE_EN"; + control-gpios = <&gpio1 15 GPIO_ACTIVE_HIGH>; + }; +*/ + vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 1>; + output-ohms = <100000>; + full-ohms = <(100000 + 100000)>; + }; + + leds { + compatible = "gpio-leds"; + red_led: led_3 { + gpios = <&gpio1 13 GPIO_ACTIVE_LOW>; + label = "Red LED"; + }; + green_led: led_2 { + gpios = <&gpio0 28 GPIO_ACTIVE_LOW>; + label = "Green LED"; + }; + blue_led: led_1 { // also broken out on header con307 on cyber60-2 Rev A1 for debug + gpios = <&gpio0 5 GPIO_ACTIVE_LOW>; + label = "Blue LED"; + }; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <11>; + rows = <6>; + map = < +RC(0,0) RC(0,1) RC(1,1) RC(0,2) RC(0,3) RC(0,4) RC(1,4) RC(0,5) RC(0,6) RC(0,7) RC(1,7) RC(0,8) RC(0,9) RC(0,10) RC(1,10) +RC(1,0) RC(2,1) RC(1,2) RC(2,2) RC(1,3) RC(2,4) RC(1,5) RC(1,6) RC(2,6) RC(2,7) RC(1,8) RC(1,9) RC(2,9) RC(3,10) +RC(2,0) RC(3,1) RC(3,2) RC(2,3) RC(3,3) RC(3,4) RC(2,5) RC(3,6) RC(4,6) RC(3,7) RC(2,8) RC(3,9) RC(2,10) +RC(3,0) RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(3,5) RC(4,5) RC(5,6) RC(4,7) RC(3,8) RC(4,8) RC(4,9) RC(4,10) +RC(5,0) RC(5,1) RC(5,2) RC(5,3) RC(5,4) RC(5,5) RC(5,7) RC(5,8) RC(5,9) RC(5,10) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&gpio0 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 23 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + col-gpios + = <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio1 10 GPIO_ACTIVE_HIGH> + , <&gpio0 4 GPIO_ACTIVE_HIGH> + , <&gpio0 19 GPIO_ACTIVE_HIGH> + , <&gpio1 4 GPIO_ACTIVE_HIGH> + , <&gpio0 22 GPIO_ACTIVE_HIGH> + , <&gpio1 6 GPIO_ACTIVE_HIGH> + , <&gpio1 2 GPIO_ACTIVE_HIGH> + , <&gpio1 1 GPIO_ACTIVE_HIGH> + , <&gpio1 3 GPIO_ACTIVE_HIGH> + , <&gpio1 0 GPIO_ACTIVE_HIGH> + ; + }; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&adc { + 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 = "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>; + }; + }; +}; \ No newline at end of file diff --git a/app/boards/arm/cyber60/cyber60.keymap b/app/boards/arm/cyber60/cyber60.keymap new file mode 100644 index 00000000..1f66c938 --- /dev/null +++ b/app/boards/arm/cyber60/cyber60.keymap @@ -0,0 +1,35 @@ +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { +// ------------------------------------------------------------------------------------------ +// | ESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | "|" | ~ | +// | TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | BKSP | +// | CAPS | A | S | D | F | G | H | J | K | L | ; | ' | ENTER | +// | SHIFT |none| Z | X | C | V | B | N | M | , | . | / | Shift | FN | +// | LCTL | LWIN | LALT | RALT | FN | SPACE | RALT | RWIN | RMENU | RCTRL | +// ------------------------------------------------------------------------------------------ + bindings = < + &kp ESC &kp NUM_1 &kp NUM_2 &kp NUM_3 &kp NUM_4 &kp NUM_5 &kp NUM_6 &kp NUM_7 &kp NUM_8 &kp NUM_9 &kp NUM_0 &kp MINUS &kp EQL &kp BSLH &kp GRAV + &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BKSP + &kp LGUI &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SCLN &kp QUOT &kp RET + &kp LSFT &none &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp CMMA &kp DOT &kp FSLH &kp RSFT &mo 1 + &kp LCTL &kp LGUI &kp LALT &kp RALT &mo 1 &kp SPC &kp RALT &kp RGUI &kp K_APP &kp RCTL + >; + }; + fn_layer { + bindings = < + &kp GRAV &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &bootloader &reset + &kp CLCK &trans &kp UP &trans &trans &trans &trans &trans &trans &trans &trans &kp UP &trans &trans + &trans &kp LEFT &kp DOWN &kp RIGHT &trans &trans &trans &trans &trans &trans &kp LEFT &kp RIGHT &trans + &trans &trans &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &trans &trans &kp DOWN &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + }; +}; \ No newline at end of file diff --git a/app/boards/arm/cyber60/cyber60.yaml b/app/boards/arm/cyber60/cyber60.yaml new file mode 100644 index 00000000..0315b0c3 --- /dev/null +++ b/app/boards/arm/cyber60/cyber60.yaml @@ -0,0 +1,15 @@ +identifier: cyber60_rev_a +name: Cyber60 Rev A +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - adc + - usb_device + - ble + - ieee802154 + - pwm + - watchdog diff --git a/app/boards/arm/cyber60/cyber60_defconfig b/app/boards/arm/cyber60/cyber60_defconfig new file mode 100644 index 00000000..ddec50d8 --- /dev/null +++ b/app/boards/arm/cyber60/cyber60_defconfig @@ -0,0 +1,20 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_CYBER60_A=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 \ No newline at end of file