diff --git a/app/boards/arm/bluehand/Kconfig b/app/boards/arm/bluehand/Kconfig new file mode 100644 index 00000000..f87c8a8e --- /dev/null +++ b/app/boards/arm/bluehand/Kconfig @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: MIT + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_BLUEHAND + diff --git a/app/boards/arm/bluehand/Kconfig.board b/app/boards/arm/bluehand/Kconfig.board new file mode 100644 index 00000000..323dfb51 --- /dev/null +++ b/app/boards/arm/bluehand/Kconfig.board @@ -0,0 +1,8 @@ +# BlueHand board configuration + +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config BOARD_BLUEHAND + bool "BlueHand" + depends on SOC_NRF52840_QIAA diff --git a/app/boards/arm/bluehand/Kconfig.defconfig b/app/boards/arm/bluehand/Kconfig.defconfig new file mode 100644 index 00000000..22e379dc --- /dev/null +++ b/app/boards/arm/bluehand/Kconfig.defconfig @@ -0,0 +1,27 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# BlueHand keyboard configuration + +if BOARD_BLUEHAND + +config ZMK_KEYBOARD_NAME + default "bluehand" + +if USB_DEVICE_STACK + +config USB_NRFX + default y + +endif # USB_DEVICE_STACK + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +endif # BOARD_BLUEHAND diff --git a/app/boards/arm/bluehand/arduino_pro_micro_pins.dtsi b/app/boards/arm/bluehand/arduino_pro_micro_pins.dtsi new file mode 100644 index 00000000..237f5c45 --- /dev/null +++ b/app/boards/arm/bluehand/arduino_pro_micro_pins.dtsi @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2020 Derek Schmell + * + * SPDX-License-Identifier: MIT + */ + +/ { + pro_micro: connector { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 8 0> /* D0 D2 */ + , <1 0 &gpio0 6 0> /* D1 D3*/ + , <2 0 &gpio0 15 0> /* D2 D1*/ + , <3 0 &gpio0 17 0> /* D3 D0*/ + , <4 0 &gpio0 20 0> /* D4/A6 D4*/ + , <5 0 &gpio0 13 0> /* D5 C6*/ + , <6 0 &gpio0 24 0> /* D6/A7 D7*/ + , <7 0 &gpio0 9 0> /* D7 E6*/ + , <8 0 &gpio0 10 0> /* D8/A8 B4*/ + , <9 0 &gpio1 6 0> /* D9/A9 B5*/ + , <10 0 &gpio1 11 0> /* D10/A10 B6*/ + , <16 0 &gpio0 28 0> /* D16 B2*/ + , <14 0 &gpio0 3 0> /* D14 B3*/ + , <15 0 &gpio1 13 0> /* D15 B1*/ + , <18 0 &gpio0 2 0> /* D18/A0 F7*/ + , <19 0 &gpio0 29 0> /* D19/A1 F6*/ + , <20 0 &gpio0 26 0> /* D20/A2 F5*/ + , <21 0 &gpio0 30 0> /* D21/A3 F4*/ + ; + }; + + 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 2 0> /* D18/A0 F7*/ + , <1 0 &gpio0 29 0> /* D19/A1 F6*/ + , <2 0 &gpio0 26 0> /* D20/A2 F5*/ + , <3 0 &gpio0 30 0> /* D21/A3 F4*/ + , <6 0 &gpio0 20 0> /* D4/A6 D4*/ + , <7 0 &gpio0 24 0> /* D6/A7 D7*/ + , <8 0 &gpio0 10 0> /* D8/A8 B4*/ + , <9 0 &gpio1 6 0> /* D9/A9 B5*/ + , <10 0 &gpio1 11 0> /* D10/A10 B6*/ + ; + }; +}; + +pro_micro_d: &pro_micro {}; +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/arm/bluehand/bluehand.dts b/app/boards/arm/bluehand/bluehand.dts new file mode 100644 index 00000000..7ed8089d --- /dev/null +++ b/app/boards/arm/bluehand/bluehand.dts @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +/dts-v1/; +#include +#include "arduino_pro_micro_pins.dtsi" + +/ { + model = "BlueHand"; + compatible = "blue,hand"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zephyr,console = &cdc_acm_uart; + zmk,kscan = &kscan0; + zmk,matrix_transform = &layout_grid_transform; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-direct"; + label = "KSCAN"; + + input-gpios + = <&gpio0 29 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 28 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 24 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&gpio0 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; + }; + + leds { + compatible = "gpio-leds"; + powerled: led_r { + gpios = <&gpio1 4 GPIO_ACTIVE_HIGH>; + label = "PWR LED"; + }; + + activityled: led_b { + gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + zephyr,user { + /* period cell corresponds to initial period */ + pwms = <&sw_pwm 0 PWM_USEC(1500) PWM_POLARITY_NORMAL>; + }; + +}; +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&usbd { + status = "okay"; + cdc_acm_uart: cdc_acm_uart { + compatible = "zephyr,cdc-acm-uart"; + label = "CDC_ACM_0"; + }; +}; + + +&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>; + }; + }; +}; + +&sw_pwm { + status = "okay"; + channel-gpios = <&gpio1 13 GPIO_ACTIVE_HIGH>; +}; + diff --git a/app/boards/arm/bluehand/bluehand_defconfig b/app/boards/arm/bluehand/bluehand_defconfig new file mode 100644 index 00000000..58670929 --- /dev/null +++ b/app/boards/arm/bluehand/bluehand_defconfig @@ -0,0 +1,21 @@ +# SPDX-License-Identifier: MIT + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_BLUEHAND=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + +CONFIG_USE_DT_CODE_PARTITION=y +CONFIG_BUILD_OUTPUT_UF2=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 diff --git a/app/boards/arm/bluehand/board.cmake b/app/boards/arm/bluehand/board.cmake new file mode 100644 index 00000000..fa847d50 --- /dev/null +++ b/app/boards/arm/bluehand/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/shields/bluehand/Kconfig.defconfig b/app/boards/shields/bluehand/Kconfig.defconfig deleted file mode 100644 index ce7e8e76..00000000 --- a/app/boards/shields/bluehand/Kconfig.defconfig +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2022 The ZMK Contributors -# SPDX-License-Identifier: MIT - -if SHIELD_BLUEHAND - -config ZMK_KEYBOARD_NAME - default "BlueHand" - -endif \ No newline at end of file diff --git a/app/boards/shields/bluehand/Kconfig.shield b/app/boards/shields/bluehand/Kconfig.shield deleted file mode 100644 index 7cfaf2cc..00000000 --- a/app/boards/shields/bluehand/Kconfig.shield +++ /dev/null @@ -1,5 +0,0 @@ -# Copyright (c) 2022 The ZMK Contributors -# SPDX-License-Identifier: MIT - -config SHIELD_BLUEHAND - def_bool $(shields_list_contains,bluehand) \ No newline at end of file