diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..652e963 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,58 @@ +on: [push, pull_request, workflow_dispatch] + +name: Build + +jobs: + build: + runs-on: ubuntu-latest + container: + image: zmkfirmware/zmk-build-arm:2.4 + name: Build + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Cache west modules + uses: actions/cache@v2 + env: + cache-name: cache-zephyr-modules + with: + path: | + modules/ + tools/ + zephyr/ + bootloader/ + zmk/ + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('manifest-dir/west.yml') }} + restore-keys: | + ${{ runner.os }}-build-${{ env.cache-name }}- + ${{ runner.os }}-build- + ${{ runner.os }}- + - name: West Init + run: west init -l config + - name: West Update + run: west update + - name: West Zephyr export + run: west zephyr-export + - name: West Build (left) + run: west build -s zmk/app -d build/left -b adv360_left -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" + - name: Adv360 Left DTS File + if: ${{ always() }} + run: cat -n build/left/zephyr/adv360_left.dts.pre.tmp + - name: Adv360 Left Kconfig file + run: cat build/left/zephyr/.config | grep -v "^#" | grep -v "^$" + - name: West Build (right) + run: west build -s zmk/app -d build/right -b adv360_right -- -DZMK_CONFIG="${GITHUB_WORKSPACE}/config" + - name: Adv360 Right DTS File + if: ${{ always() }} + run: cat -n build/right/zephyr/adv360_right.dts.pre.tmp + - name: Adv360 Right Kconfig file + run: cat build/right/zephyr/.config | grep -v "^#" | grep -v "^$" + - name: Rename zmk.uf2 + run: cp build/left/zephyr/zmk.uf2 left.uf2 && cp build/right/zephyr/zmk.uf2 right.uf2 + - name: Archive (Adv360) + uses: actions/upload-artifact@v2 + with: + name: firmware + path: | + left.uf2 + right.uf2 diff --git a/config/adv360.keymap b/config/adv360.keymap new file mode 100644 index 0000000..a452743 --- /dev/null +++ b/config/adv360.keymap @@ -0,0 +1,62 @@ +#include +#include +#include +#include +#include + +/ { + behaviors { + #include "macros.dtsi" + + hm: homerow_mods { + compatible = "zmk,behavior-hold-tap"; + label = "HOMEROW_MODS"; + #binding-cells = <2>; + tapping-term-ms = <200>; + quick_tap_ms = <175>; + flavor = "tap-preferred"; + bindings = <&kp>, <&kp>; + }; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &tog 1 &mo 3 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS + &kp TAB &kp Q &kp W &kp E &kp R &kp T &none ¯o_kinesis &kp Y &kp U &kp I &kp O &kp P &kp BSLH + &kp ESC &kp A &kp S &kp D &kp F &kp G &none &kp LCTRL &kp LALT &kp LGUI &kp RCTRL &none &kp H &kp J &kp K &kp L &kp SEMI &kp SQT + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &none &none &kp HOME &none &none &kp PG_UP &none &none &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT + &mo 2 &kp GRAVE &kp CAPS &kp LEFT &kp RIGHT &kp BKSP &kp DEL &kp END &kp PG_DN &kp ENTER &kp SPACE &kp UP &kp DOWN &kp LBKT &kp RBKT &mo 2 + >; + }; + keypad { + bindings = < + &kp EQUAL &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &trans &mo 3 &kp N6 &kp KP_NUM &kp KP_EQUAL &kp KP_DIVIDE &kp KP_MULTIPLY &kp MINUS + &kp TAB &kp Q &kp W &kp E &kp R &kp T &none &none &kp Y &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS &kp BSLH + &kp ESC &kp A &kp S &kp D &kp F &kp G &none &kp LCTRL &kp LALT &kp LGUI &kp RCTRL &none &kp H &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS &kp SQT + &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &none &none &kp HOME &none &none &kp PG_UP &none &none &kp N &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER &kp RSHFT + &mo 2 &kp GRAVE &kp CAPS &kp LEFT &kp RIGHT &kp BKSP &kp DEL &kp END &kp PG_DN &kp ENTER &kp KP_N0 &kp UP &kp DOWN &kp KP_DOT &kp RBKT &mo 2 + >; + }; + fn { + bindings = < + &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &tog 1 &mo 3 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 + &trans &trans &trans &trans &trans &trans &none &none &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &none &trans &trans &trans &trans &none &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &none &none &trans &none &none &trans &none &none &trans &trans &trans &trans &trans &trans + &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans + >; + }; + mod { + bindings = < + &none &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none &trans &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &none + &none &none &none &none &none &none &bootloader &bootloader &none &none &none &none &none &none + &none &none &none &none &none &none &rgb_ug RGB_MEFS_CMD 5 &bt BT_CLR &bt BT_CLR &bt BT_CLR &bt BT_CLR &rgb_ug RGB_MEFS_CMD 5 &none &none &none &none &none &none + &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none &none + &none &none &none &bl BL_INC &bl BL_DEC &rgb_ug RGB_TOG &bl BL_TOG &none &none &bl BL_TOG &rgb_ug RGB_TOG &bl BL_INC &bl BL_DEC &none &none &none + >; + }; + }; +}; diff --git a/config/adv360_left.keymap b/config/adv360_left.keymap new file mode 100644 index 0000000..bc222c6 --- /dev/null +++ b/config/adv360_left.keymap @@ -0,0 +1,8 @@ +/* +* +* Copyright (c) 2021 Polarity Works +* SPDX-License-Identifier: MIT +* +*/ + +#include "adv360.keymap" diff --git a/config/adv360_right.keymap b/config/adv360_right.keymap new file mode 100644 index 0000000..bc222c6 --- /dev/null +++ b/config/adv360_right.keymap @@ -0,0 +1,8 @@ +/* +* +* Copyright (c) 2021 Polarity Works +* SPDX-License-Identifier: MIT +* +*/ + +#include "adv360.keymap" diff --git a/config/boards/arm/adv360/CMakeLists.txt b/config/boards/arm/adv360/CMakeLists.txt new file mode 100644 index 0000000..7b388db --- /dev/null +++ b/config/boards/arm/adv360/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/config/boards/arm/adv360/Kconfig b/config/boards/arm/adv360/Kconfig new file mode 100644 index 0000000..148ad95 --- /dev/null +++ b/config/boards/arm/adv360/Kconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: MIT + +config BOARD_ENABLE_DCDC + bool "Enable DCDC mode" + select SOC_DCDC_NRF52X + default y + depends on BOARD_BT60 diff --git a/config/boards/arm/adv360/Kconfig.board b/config/boards/arm/adv360/Kconfig.board new file mode 100644 index 0000000..cacf2cf --- /dev/null +++ b/config/boards/arm/adv360/Kconfig.board @@ -0,0 +1,12 @@ +# +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT +# + +config BOARD_ADV360_LEFT + bool "adv360_left" + depends on SOC_NRF52840_QIAA + +config BOARD_ADV360_RIGHT + bool "adv360_right" + depends on SOC_NRF52840_QIAA diff --git a/config/boards/arm/adv360/Kconfig.defconfig b/config/boards/arm/adv360/Kconfig.defconfig new file mode 100644 index 0000000..9d60f88 --- /dev/null +++ b/config/boards/arm/adv360/Kconfig.defconfig @@ -0,0 +1,60 @@ +# +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT +# + +if BOARD_ADV360_LEFT + + config ZMK_KEYBOARD_NAME + default "Adv360 Pro" + +endif # BOARD_ADV360_LEFT + +if BOARD_ADV360_RIGHT + + config ZMK_KEYBOARD_NAME + default "Adv360 Pro rt" + +endif # BOARD_ADV360_RIGHT + + +if BOARD_ADV360_LEFT || BOARD_ADV360_RIGHT + +config BOARD + default "adv360" + +config ZMK_SPLIT + default y + +config SPI + bool + default y + +config BT_CTLR + default BT + +config ZMK_BLE + default y + +config ZMK_USB + default y + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +config ZMK_BATTERY_VOLTAGE_DIVIDER + default y + +config SPI + default y + + + +endif # BOARD_ADV360_LEFT || BOARD_ADV360_RIGHT diff --git a/config/boards/arm/adv360/adv360.dtsi b/config/boards/arm/adv360/adv360.dtsi new file mode 100644 index 0000000..c25243b --- /dev/null +++ b/config/boards/arm/adv360/adv360.dtsi @@ -0,0 +1,170 @@ +/* +* +* Copyright (c) 2021 Polarity Works +* SPDX-License-Identifier: MIT +* +*/ + +/dts-v1/; +#include + +#include + +/ { + model = "Adv360"; + compatible = "adv360"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + zmk,underglow = &led_strip; + zmk,backlight = &backlight; + zmk,matrix_transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <22>; + rows = <5>; + + + map = < + RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,15) RC(4,16) RC(4,17) RC(4,18) RC(4,19) RC(4,20) RC(4,21) + RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,15) RC(3,16) RC(3,17) RC(3,18) RC(3,19) RC(3,20) RC(3,21) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,8) RC(2,9) RC(2,12) RC(2,13) RC(2,15) RC(2,16) RC(2,17) RC(2,18) RC(2,19) RC(2,20) RC(2,21) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14) RC(1,16) RC(1,17) RC(1,18) RC(1,19) RC(1,20) RC(1,21) + RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,7) RC(0,8) RC(0,9) RC(0,12) RC(0,13) RC(0,14) RC(0,17) RC(0,18) RC(0,19) RC(0,20) RC(0,21) + + >; + }; + ext-power { + compatible = "zmk,ext-power-generic"; + label = "EXT_POWER"; + control-gpios = <&gpio0 13 GPIO_ACTIVE_HIGH>; + }; + backlight: pwmleds { + compatible = "pwm-leds"; + label = "Backlight LEDs"; + pwm_led_0 { + pwms = <&pwm0 17>; + label = "Backlight LED 0"; + }; + +}; + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + + vbatt { + compatible = "zmk,battery-voltage-divider"; + label = "BATTERY"; + io-channels = <&adc 2>; + output-ohms = <100000>; + full-ohms = <(100000 + 100000)>; + }; +}; + +&pwm0 { + status = "okay"; + ch0-pin = <17>; +}; + +&adc { + status = "okay"; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&usbd { + status = "okay"; +}; + +&uart0 { + compatible = "nordic,nrf-uarte"; + status = "okay"; + current-speed = <115200>; + tx-pin = <39>; + rx-pin = <44>; + rts-pin = <34>; + cts-pin = <9>; +}; + + +&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>; + }; + }; +}; + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <20>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <27>; + miso-pin = <8>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <3>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; diff --git a/config/boards/arm/adv360/adv360.yaml b/config/boards/arm/adv360/adv360.yaml new file mode 100644 index 0000000..1cefe88 --- /dev/null +++ b/config/boards/arm/adv360/adv360.yaml @@ -0,0 +1,19 @@ +identifier: adv360 +name: Adv360 +type: keyboard +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +supported: + - gpio + - i2c + - counter + - spi + - usb_device + - nvs + - can + - kscan + - ble + - pwm diff --git a/config/boards/arm/adv360/adv360_left.dts b/config/boards/arm/adv360/adv360_left.dts new file mode 100644 index 0000000..8055fd1 --- /dev/null +++ b/config/boards/arm/adv360/adv360_left.dts @@ -0,0 +1,47 @@ +/* +* +* Copyright (c) 2021 Polarity Works +* SPDX-License-Identifier: MIT +* +*/ + +#include "adv360.dtsi" + +/{ + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 12 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + col-gpios + = <&gpio0 25 GPIO_ACTIVE_HIGH> + , <&gpio0 11 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> + , <&gpio1 9 GPIO_ACTIVE_HIGH> + , <&gpio0 12 GPIO_ACTIVE_HIGH> + , <&gpio0 7 GPIO_ACTIVE_HIGH> + , <&gpio0 5 GPIO_ACTIVE_HIGH> + ; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + +}; diff --git a/config/boards/arm/adv360/adv360_left_defconfig b/config/boards/arm/adv360/adv360_left_defconfig new file mode 100644 index 0000000..8972881 --- /dev/null +++ b/config/boards/arm/adv360/adv360_left_defconfig @@ -0,0 +1,84 @@ +# +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT +# + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_ADV360_LEFT=y +CONFIG_ZMK_SPLIT=y +CONFIG_ZMK_SPLIT_BLE=y +CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + + +# Enable SPI +CONFIG_SPI=y + +CONFIG_SPI_NRFX=y + +# Enable writing to flash +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 + +# Enable 32kHz crystal +CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y + +CONFIG_ZMK_RGB_UNDERGLOW=y +CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y +CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y +CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=4 +CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=y + +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y +CONFIG_PWM=y +CONFIG_ZMK_LED_PWM=y +CONFIG_ZMK_BACKLIGHT=y +CONFIG_ZMK_BACKLIGHT_BRT_START=20 +CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE=y + +CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y +CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC=y + + +# Turn on logging, and set ZMK logging to debug output +CONFIG_LOG=y +CONFIG_ZMK_USB_LOGGING=y +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_LOG_BUFFER_SIZE=65536 +CONFIG_LOG_STRDUP_BUF_COUNT=160 +#CONFIG_I2C_LOG_LEVEL_DBG=y +#CONFIG_SPI_LOG_LEVEL_DBG=y + + +# Turn on USB CDC ACM device +CONFIG_USB=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_CDC_ACM=y +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 +CONFIG_USB_CDC_ACM_DEVICE_NAME="CDC_ACM" +CONFIG_USB_CDC_ACM_DEVICE_COUNT=1 + +# Enable serial console +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y + +# Enable USB UART, and set the console device +CONFIG_UART_CONSOLE=y +CONFIG_USB_UART_CONSOLE=y +CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" diff --git a/config/boards/arm/adv360/adv360_right.dts b/config/boards/arm/adv360/adv360_right.dts new file mode 100644 index 0000000..afd38f3 --- /dev/null +++ b/config/boards/arm/adv360/adv360_right.dts @@ -0,0 +1,54 @@ +/* +* +* Copyright (c) 2021 Polarity Works +* SPDX-License-Identifier: MIT +* +*/ + +#include "adv360.dtsi" + +/{ + + + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "col2row"; + row-gpios + = <&gpio0 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + col-gpios + = <&gpio1 14 GPIO_ACTIVE_HIGH> + , <&gpio0 12 GPIO_ACTIVE_HIGH> + , <&gpio1 9 GPIO_ACTIVE_HIGH> + , <&gpio0 7 GPIO_ACTIVE_HIGH> + , <&gpio1 11 GPIO_ACTIVE_HIGH> + , <&gpio1 10 GPIO_ACTIVE_HIGH> + , <&gpio1 13 GPIO_ACTIVE_HIGH> + , <&gpio1 15 GPIO_ACTIVE_HIGH> + , <&gpio0 3 GPIO_ACTIVE_HIGH> + , <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio0 28 GPIO_ACTIVE_HIGH> + ; + }; + + leds { + compatible = "gpio-leds"; + blue_led: led_0 { + gpios = <&gpio0 15 GPIO_ACTIVE_HIGH>; + label = "Blue LED"; + }; + }; + +}; + +&default_transform { + col-offset = <11>; + }; diff --git a/config/boards/arm/adv360/adv360_right_defconfig b/config/boards/arm/adv360/adv360_right_defconfig new file mode 100644 index 0000000..ebad2a4 --- /dev/null +++ b/config/boards/arm/adv360/adv360_right_defconfig @@ -0,0 +1,83 @@ +# +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT +# + +CONFIG_SOC_SERIES_NRF52X=y +CONFIG_SOC_NRF52840_QIAA=y +CONFIG_BOARD_ADV360_RIGHT=y +CONFIG_ZMK_SPLIT_BLE=y +#CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL=y + +# Enable MPU +CONFIG_ARM_MPU=y + +# enable GPIO +CONFIG_GPIO=y + + + +# Enable SPI +CONFIG_SPI=y +CONFIG_SPI_NRFX=y + +# Enable writing to flash +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 + +# Enable 32kHz crystal +CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y + +CONFIG_ZMK_RGB_UNDERGLOW=y +CONFIG_ZMK_RGB_UNDERGLOW_EXT_POWER=y +CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y +CONFIG_ZMK_RGB_UNDERGLOW_EFF_START=4 +CONFIG_ZMK_RGB_UNDERGLOW_AUTO_OFF_IDLE=y + +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y +CONFIG_PWM=y +CONFIG_ZMK_LED_PWM=y +CONFIG_ZMK_BACKLIGHT=y +CONFIG_ZMK_BACKLIGHT_BRT_START=20 +CONFIG_ZMK_BACKLIGHT_AUTO_OFF_IDLE=y + +CONFIG_ZMK_HID_REPORT_TYPE_NKRO=y +CONFIG_ZMK_HID_CONSUMER_REPORT_USAGES_BASIC=y + + +# Turn on logging, and set ZMK logging to debug output +CONFIG_LOG=y +CONFIG_ZMK_USB_LOGGING=y +CONFIG_ZMK_LOG_LEVEL_DBG=y +CONFIG_LOG_BUFFER_SIZE=10000 +CONFIG_LOG_STRDUP_BUF_COUNT=60 +#CONFIG_I2C_LOG_LEVEL_DBG=y +#CONFIG_SPI_LOG_LEVEL_DBG=y + + +# Turn on USB CDC ACM device +CONFIG_USB=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_CDC_ACM=y +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 +CONFIG_USB_CDC_ACM_DEVICE_NAME="CDC_ACM" +CONFIG_USB_CDC_ACM_DEVICE_COUNT=1 + +# Enable serial console +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y + +# Enable USB UART, and set the console device +CONFIG_UART_CONSOLE=y +CONFIG_USB_UART_CONSOLE=y +CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" diff --git a/config/boards/arm/adv360/board.cmake b/config/boards/arm/adv360/board.cmake new file mode 100644 index 0000000..4eb4820 --- /dev/null +++ b/config/boards/arm/adv360/board.cmake @@ -0,0 +1,9 @@ +# +# Copyright (c) 2021 Polarity Works +# SPDX-License-Identifier: MIT +# + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") + +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) +#include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake) diff --git a/config/info.json b/config/info.json new file mode 100644 index 0000000..e9bb7b5 --- /dev/null +++ b/config/info.json @@ -0,0 +1,95 @@ +{ + "layouts": { + "LAYOUT": { + "layout": [ + { "label": "=", "row": 0, "col": 0, "x": 0, "y": 0.25, "w":1.25 }, + { "label": "1", "row": 0, "col": 1, "x": 1.25, "y": 0.25 }, + { "label": "2", "row": 0, "col": 2, "x": 2.25, "y": 0 }, + { "label": "3", "row": 0, "col": 3, "x": 3.25, "y": 0 }, + { "label": "4", "row": 0, "col": 4, "x": 4.25, "y": 0 }, + { "label": "5", "row": 0, "col": 5, "x": 5.25, "y": 0 }, + { "label": "mod1", "row": 0, "col": 6, "x": 6.25, "y": 0 }, + { "label": "mod2", "row": 0, "col": 7, "x": 10.75, "y": 0 }, + { "label": "6", "row": 0, "col": 8, "x": 11.75, "y": 0 }, + { "label": "7", "row": 0, "col": 9, "x": 12.75, "y": 0 }, + { "label": "8", "row": 0, "col": 10, "x": 13.75, "y": 0 }, + { "label": "9", "row": 0, "col": 11, "x": 14.75, "y": 0 }, + { "label": "0", "row": 0, "col": 12, "x": 15.75, "y": 0.25 }, + { "label": "-", "row": 0, "col": 13, "x": 16.75, "y": 0.25, "w": 1.25 }, + + { "label": "Tab", "row": 1, "col": 0, "x": 0, "y": 1.25, "w": 1.25 }, + { "label": "Q", "row": 1, "col": 1, "x": 1.25, "y": 1.25 }, + { "label": "W", "row": 1, "col": 2, "x": 2.25, "y": 1 }, + { "label": "E", "row": 1, "col": 3, "x": 3.25, "y": 1 }, + { "label": "R", "row": 1, "col": 4, "x": 4.25, "y": 1 }, + { "label": "T", "row": 1, "col": 5, "x": 5.25, "y": 1 }, + { "label": "mod3", "row": 1, "col": 6, "x": 6.25, "y": 1 }, + { "label": "mod4", "row": 1, "col": 7, "x": 10.75, "y": 1 }, + { "label": "Y", "row": 1, "col": 8, "x": 11.75, "y": 1 }, + { "label": "U", "row": 1, "col": 9, "x": 12.75, "y": 1 }, + { "label": "I", "row": 1, "col": 10, "x": 13.75, "y": 1 }, + { "label": "O", "row": 1, "col": 11, "x": 14.75, "y": 1 }, + { "label": "P", "row": 1, "col": 12, "x": 15.75, "y": 1.25 }, + { "label": "\\", "row": 1, "col": 13, "x": 16.75, "y": 1.25, "w": 1.25 }, + + + { "label": "Caps", "row": 2, "col": 0, "x": 0, "y": 2.25, "w":1.25 }, + { "label": "A", "row": 2, "col": 1, "x": 1.25, "y": 2.25 }, + { "label": "S", "row": 2, "col": 2, "x": 2.25, "y": 2 }, + { "label": "D", "row": 2, "col": 3, "x": 3.25, "y": 2 }, + { "label": "F", "row": 2, "col": 4, "x": 4.25, "y": 2 }, + { "label": "G", "row": 2, "col": 5, "x": 5.25, "y": 2 }, + { "label": "mod5", "row": 2, "col": 6, "x": 6.25, "y": 2}, + { "label": "LCtrl", "row": 2, "col": 7, "x": 6.75, "y": 4, "r":15, "rx":5.25 ,"ry":4}, + { "label": "LAlt", "row": 2, "col": 8, "x": 7.75, "y": 4, "r":15, "rx":5.25 ,"ry":4}, + { "label": "LGui", "row": 2, "col": 11, "x": 9.25, "y": 4, "r":-15, "rx":12.75 ,"ry":4}, + { "label": "RCtrl", "row": 2, "col": 12, "x": 10.25, "y": 4, "r":-15, "rx":12.75 ,"ry":4}, + { "label": "mod6", "row": 2, "col": 13, "x": 10.75, "y": 2}, + { "label": "H", "row": 2, "col": 14, "x": 11.75, "y": 2 }, + { "label": "J", "row": 2, "col": 15, "x": 12.75, "y": 2 }, + { "label": "K", "row": 2, "col": 16, "x": 13.75, "y": 2 }, + { "label": "L", "row": 2, "col": 17, "x": 14.75, "y": 2 }, + { "label": ";", "row": 2, "col": 18, "x": 15.75, "y": 2.25 }, + { "label": "'", "row": 2, "col": 19, "x": 16.75, "y": 2.25, "w":1.25 }, + + { "label": "LShift", "row": 3, "col": 0, "x": 0, "y": 3.25, "w":1.25 }, + { "label": "Z", "row": 3, "col": 1, "x": 1.25, "y": 3.25 }, + { "label": "X", "row": 3, "col": 2, "x": 2.25, "y": 3 }, + { "label": "C", "row": 3, "col": 3, "x": 3.25, "y": 3 }, + { "label": "V", "row": 3, "col": 4, "x": 4.25, "y": 3 }, + { "label": "B", "row": 3, "col": 5, "x": 5.25, "y": 3 }, + { "label": "1U1", "row": 3, "col": 6, "x": 5.75, "y": 5, "r":15, "rx":5.25 ,"ry":4, "h":0.5}, + { "label": "1U2", "row": 3, "col": 7, "x": 6.75, "y": 5, "r":15, "rx":5.25 ,"ry":4, "h":0.5}, + { "label": "Home", "row": 3, "col": 8, "x": 7.75, "y": 5, "r":15, "rx":5.25 ,"ry":4}, + { "label": "Ped3", "row": 3, "col": 9, "x": 20, "y": 5}, + { "label": "Ped4", "row": 3, "col": 10, "x": 21, "y": 5}, + { "label": "PgUp", "row": 3, "col": 11, "x": 9.25, "y": 5, "r":-15, "rx":12.75 ,"ry":4}, + { "label": "1U3", "row": 3, "col": 12, "x": 10.25, "y": 5, "r":-15, "rx":12.75 ,"ry":4, "h":0.5}, + { "label": "1U4", "row": 3, "col": 13, "x": 11.25, "y": 5, "r":-15, "rx":12.75 ,"ry":4, "h":0.5}, + { "label": "N", "row": 3, "col": 14, "x": 11.75, "y": 3 }, + { "label": "M", "row": 3, "col": 15, "x": 12.75, "y": 3 }, + { "label": ",", "row": 3, "col": 16, "x": 13.75, "y": 3 }, + { "label": ".", "row": 3, "col": 17, "x": 14.75, "y": 3 }, + { "label": "/", "row": 3, "col": 18, "x": 15.75, "y": 3.25 }, + { "label": "RShift", "row": 3, "col": 19, "x": 16.75, "y": 3.25, "w":1.25 }, + + { "label": "mod7", "row": 4, "col": 0, "x": 0, "y": 4.25, "w":1.25}, + { "label": "`", "row": 4, "col": 1, "x": 1.25, "y": 4.25 }, + { "label": "\\", "row": 4, "col": 2, "x": 2.25, "y": 4 }, + { "label": "V", "row": 4, "col": 3, "x": 3.25, "y": 4 }, + { "label": "B", "row": 4, "col": 4, "x": 4.25, "y": 4 }, + { "label": "Bksp", "row": 4, "col": 5, "x": 5.75, "y": 5.5, "r":15, "rx":5.25 ,"ry":4, "h":1.5}, + { "label": "Del", "row": 4, "col": 6, "x": 6.75, "y": 5.5, "r":15, "rx":5.25 ,"ry":4, "h":1.5}, + { "label": "End", "row": 4, "col": 7, "x": 7.75, "y": 6, "r":15, "rx":5.25 ,"ry":4}, + { "label": "PgDn", "row": 4, "col": 8, "x": 9.25, "y": 6, "r":-15, "rx":12.75 ,"ry":4}, + { "label": "Enter", "row": 4, "col": 9, "x": 10.25, "y": 5.5, "r":-15, "rx":12.75 ,"ry":4, "h":1.5}, + { "label": "Space", "row": 4, "col": 10, "x": 11.25, "y": 5.5, "r":-15, "rx":12.75 ,"ry":4, "h":1.5}, + { "label": "Up", "row": 4, "col": 11, "x": 12.75, "y": 4 }, + { "label": "Down", "row": 4, "col": 12, "x": 13.75, "y": 4 }, + { "label": ",", "row": 4, "col": 13, "x": 14.75, "y": 4 }, + { "label": ".", "row": 4, "col": 14, "x": 15.75, "y": 4.25 }, + { "label": "mod8", "row": 4, "col": 15, "x": 16.75, "y": 4.25, "w":1.25 } + ] + } + } +} diff --git a/config/keymap.json b/config/keymap.json new file mode 100644 index 0000000..7859c7c --- /dev/null +++ b/config/keymap.json @@ -0,0 +1,38 @@ +{ + "keyboard": "adv360", + "keymap": "default", + "layout": "LAYOUT", + "layer_names": [ + "base", + "keypad", + "fn", + "mod" + ], + "layers": [ + [ + "&kp EQUAL ", "&kp N1 ", "&kp N2 ", "&kp N3 ", "&kp N4 ", "&kp N5 ", "&tog 1 ", "&mo 3 ", "&kp N6 ", "&kp N7 ", "&kp N8 ", "&kp N9 ", "&kp N0 ", "&kp MINUS", + "&kp TAB ", "&kp Q ", "&kp W ", "&kp E ", "&kp R ", "&kp T ", "&none ", "&none ", "&kp Y ", "&kp U ", "&kp I ", "&kp O ", "&kp P ", "&kp BSLH", + "&kp ESC ", "&kp A ", "&kp S ", "&kp D ", "&kp F ", "&kp G ", "&none ", "&kp LCTRL ", "&kp LALT " , "&kp LGUI ", "&kp RCTRL ", "&none ", "&kp H ", "&kp J ", "&kp K ", "&kp L ", "&kp SEMI ", "&kp SQT", + "&kp LSHFT ", "&kp Z ", "&kp X ", "&kp C ", "&kp V ", "&kp B ", "&none ", "&none ", "&kp HOME ", "&none ", "&none ", "&kp PG_UP ", "&none ", "&none ", "&kp N ", "&kp M ", "&kp COMMA ", "&kp DOT ", "&kp FSLH ", "&kp RSHFT", + "&mo 2 ", "&kp GRAVE ", "&kp CAPS ", "&kp LEFT ", "&kp RIGHT ", "&kp BSPC ", "&kp DEL ", "&kp END ", "&kp PG_DN ", "&kp ENTER ", "&kp SPACE ", "&kp UP ", "&kp DOWN ", "&kp LBKT ", "&kp RBKT ", "&mo 2" + ], [ + "&kp EQUAL ", "&kp N1 ", "&kp N2 ", "&kp N3 ", "&kp N4 ", "&kp N5 ", "&trans ", "&mo 3 ", "&kp N6 ", "&kp KP_NUM ", "&kp KP_EQUAL ", "&kp KP_DIVIDE ", "&kp KP_MULTIPLY ", "&kp MINUS", + "&kp TAB ", "&kp Q ", "&kp W ", "&kp E ", "&kp R ", "&kp T ", "&none ", "&none ", "&kp Y ", "&kp KP_N7 ", "&kp KP_N8 ", "&kp KP_N9 ", "&kp KP_MINUS ", "&kp BSLH", + "&kp ESC ", "&kp A ", "&kp S ", "&kp D ", "&kp F ", "&kp G ", "&none ", "&kp LCTRL ", "&kp LALT " , "&kp LGUI ", "&kp RCTRL ", "&none ", "&kp H ", "&kp KP_N4 ", "&kp KP_N5 ", "&kp KP_N6 ", "&kp KP_PLUS ", "&kp SQT", + "&kp LSHFT ", "&kp Z ", "&kp X ", "&kp C ", "&kp V ", "&kp B ", "&none ", "&none ", "&kp HOME ", "&none ", "&none ", "&kp PG_UP ", "&none ", "&none ", "&kp N ", "&kp KP_N1 ", "&kp KP_N2 ", "&kp KP_N3 ", "&kp KP_ENTER ", "&kp RSHFT", + "&mo 2 ", "&kp GRAVE ", "&kp CAPS ", "&kp LEFT ", "&kp RIGHT ", "&kp BSPC ", "&kp DEL ", "&kp END ", "&kp PG_DN ", "&kp ENTER ", "&kp KP_N0 ", "&kp UP ", "&kp DOWN ", "&kp KP_DOT ", "&kp RBKT ", "&mo 2" + ], [ + "&kp F1 ", "&kp F2 ", "&kp F3 ", "&kp F4 ", "&kp F5 ", "&kp F6 ", "&tog 1 ", "&mo 3 ", "&kp F7 ", "&kp F8 ", "&kp F9 ", "&kp F10 ", "&kp F11 ", "&kp F12", + "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&none ", "&none ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", + "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&none ", "&trans ", "&trans " , "&trans ", "&trans ", "&none ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", + "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&none ", "&none ", "&trans ", "&none ", "&none ", "&trans ", "&none ", "&none ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", + "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans ", "&trans" + ], [ + "&none ", "&bt BT_SEL 0 ", "&bt BT_SEL 1 ", "&bt BT_SEL 2 ", "&bt BT_SEL 3 ", "&bt BT_SEL 4 ", "&none ", "&trans ", "&bt BT_SEL 0 ", "&bt BT_SEL 1 ", "&bt BT_SEL 2 ", "&bt BT_SEL 3 ", "&bt BT_SEL 4 ", "&none", + "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&bootloader ", "&bootloader ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none", + "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&rgb_ug RGB_MEFS_CMD 5 ", "&bt BT_CLR ", "&none " , "&bt BT_CLR ", "&bt BT_CLR ", "&rgb_ug RGB_MEFS_CMD 5 ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none", + "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none ", "&none", + "&none ", "&none ", "&none ", "&bl BL_INC ", "&bl BL_DEC ", "&rgb_ug RGB_TOG ", "&bl BL_TOG ", "&none ", "&none ", "&bl BL_TOG ", "&rgb_ug RGB_TOG ", "&bl BL_INC ", "&bl BL_DEC ", "&none ", "&none ", "&none" + ] + ] +} diff --git a/config/macros.dtsi b/config/macros.dtsi new file mode 100644 index 0000000..69f6c4f --- /dev/null +++ b/config/macros.dtsi @@ -0,0 +1,36 @@ + macro_quotes: macro_quotes { + compatible = "zmk,behavior-macro"; + label = "macro_quotes"; + #binding-cells = <0>; + bindings = <&kp SQT>, <&kp SQT>, <&kp LEFT>; + }; + macro_dquotes: macro_dquotes { + compatible = "zmk,behavior-macro"; + label = "macro_dquotes"; + #binding-cells = <0>; + bindings = <&kp DQT>, <&kp DQT>, <&kp LEFT>; + }; + macro_braces: macro_braces { + compatible = "zmk,behavior-macro"; + label = "macro_braces"; + #binding-cells = <0>; + bindings = <&kp LBRC>, <&kp RBRC>, <&kp LEFT>; + }; + macro_parens: macro_parens { + compatible = "zmk,behavior-macro"; + label = "macro_parens"; + #binding-cells = <0>; + bindings = <&kp LPAR>, <&kp RPAR>, <&kp LEFT>; + }; + macro_brackets: macro_brackets { + compatible = "zmk,behavior-macro"; + label = "macro_brackets"; + #binding-cells = <0>; + bindings = <&kp LBKT>, <&kp RBKT>, <&kp LEFT>; + }; + macro_kinesis: macro_kinesis { + compatible = "zmk,behavior-macro"; + label = "macro_kinesis"; + #binding-cells = <0>; + bindings = <&kp K>, <&kp I>, <&kp N>, <&kp E>, <&kp S>, <&kp I>, <&kp S>; + }; diff --git a/config/west.yml b/config/west.yml new file mode 100644 index 0000000..f2a49f7 --- /dev/null +++ b/config/west.yml @@ -0,0 +1,13 @@ +manifest: + remotes: + - name: zmkfirmware + url-base: https://github.com/zmkfirmware + - name: refil + url-base: https://github.com/refil + projects: + - name: zmk + remote: refil + revision: adv360-beta + import: app/west.yml + self: + path: config diff --git a/settings-reset.uf2 b/settings-reset.uf2 new file mode 100644 index 0000000..9e6223a Binary files /dev/null and b/settings-reset.uf2 differ