diff --git a/boards/nice_nano.overlay b/boards/nice_nano.overlay new file mode 100644 index 0000000..424a617 --- /dev/null +++ b/boards/nice_nano.overlay @@ -0,0 +1,46 @@ +#include + +&pinctrl { + spi3_default: spi3_default { + group1 { + psels = ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&spi3 { + compatible = "nordic,nrf-spim"; + status = "okay"; + + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/boards/nice_nano_v2.overlay b/boards/nice_nano_v2.overlay new file mode 100644 index 0000000..424a617 --- /dev/null +++ b/boards/nice_nano_v2.overlay @@ -0,0 +1,46 @@ +#include + +&pinctrl { + spi3_default: spi3_default { + group1 { + psels = ; + }; + }; + + spi3_sleep: spi3_sleep { + group1 { + psels = ; + low-power-enable; + }; + }; +}; + +&spi3 { + compatible = "nordic,nrf-spim"; + status = "okay"; + + pinctrl-0 = <&spi3_default>; + pinctrl-1 = <&spi3_sleep>; + pinctrl-names = "default", "sleep"; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <10>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + + color-mapping = ; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/boards/shields/corne/Kconfig.defconfig b/boards/shields/corne/Kconfig.defconfig new file mode 100644 index 0000000..54be731 --- /dev/null +++ b/boards/shields/corne/Kconfig.defconfig @@ -0,0 +1,46 @@ +if SHIELD_CORNE_LEFT || SHIELD_CORNE_DONGLE + +config ZMK_KEYBOARD_NAME + default "Corne" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +config ZMK_USB + default y + +endif + +if SHIELD_CORNE_LEFT || SHIELD_CORNE_RIGHT || SHIELD_CORNE_DONGLE || SHIELD_CORNE_PERIPHERAL_LEFT + +config ZMK_SPLIT + default y + +if ZMK_DISPLAY + +config I2C + default y + +config SSD1306 + default y + +endif # ZMK_DISPLAY + +if LVGL + +config LV_Z_VDB_SIZE + default 64 + +config LV_DPI_DEF + default 148 + +config LV_Z_BITS_PER_PIXEL + default 1 + +choice LV_COLOR_DEPTH + default LV_COLOR_DEPTH_1 +endchoice + +endif # LVGL + +endif diff --git a/boards/shields/corne/Kconfig.shield b/boards/shields/corne/Kconfig.shield new file mode 100644 index 0000000..dbcb528 --- /dev/null +++ b/boards/shields/corne/Kconfig.shield @@ -0,0 +1,14 @@ +# Copyright (c) 2020 Pete Johanson +# SPDX-License-Identifier: MIT + +config SHIELD_CORNE_LEFT + def_bool $(shields_list_contains,corne_left) + +config SHIELD_CORNE_RIGHT + def_bool $(shields_list_contains,corne_right) + +config SHIELD_CORNE_DONGLE + def_bool $(shields_list_contains,corne_dongle) + +config SHIELD_CORNE_PERIPHERAL_LEFT + def_bool $(shields_list_contains,corne_peripheral_left) diff --git a/boards/shields/corne/corne.dtsi b/boards/shields/corne/corne.dtsi new file mode 100644 index 0000000..f6d41e3 --- /dev/null +++ b/boards/shields/corne/corne.dtsi @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zephyr,display = &oled; + zmk,kscan = &kscan0; + zmk,matrix-transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <12>; + rows = <4>; +// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | +// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | +// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | + 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,10) RC(1,11) +RC(2,0) RC(2,1) 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,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) + >; + }; + + five_column_transform: keymap_transform_1 { + compatible = "zmk,matrix-transform"; + columns = <10>; + rows = <4>; +// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | +// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | +// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | + map = < +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(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,10) +RC(2,1) 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(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + + diode-direction = "col2row"; + row-gpios + = <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + // TODO: per-key RGB node(s)? +}; + +&pro_micro_i2c { + status = "okay"; + + oled: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + width = <128>; + height = <32>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <31>; + segment-remap; + com-invdir; + com-sequential; + inversion-on; + prechargep = <0x22>; + }; +}; diff --git a/boards/shields/corne/corne.zmk.yml b/boards/shields/corne/corne.zmk.yml new file mode 100644 index 0000000..b7c05f2 --- /dev/null +++ b/boards/shields/corne/corne.zmk.yml @@ -0,0 +1,15 @@ +file_format: "1" +id: corne +name: Corne +type: shield +url: https://github.com/foostan/crkbd/ +requires: [pro_micro] +exposes: [i2c_oled] +features: + - keys + - display +siblings: + - corne_left + - corne_right + - corne_dongle + - corne_peripheral_left diff --git a/boards/shields/corne/corne_dongle.conf b/boards/shields/corne/corne_dongle.conf new file mode 100644 index 0000000..330217a --- /dev/null +++ b/boards/shields/corne/corne_dongle.conf @@ -0,0 +1,6 @@ +CONFIG_BT_CTLR_TX_PWR_PLUS_8=y +CONFIG_ZMK_SLEEP=n + +# Allow multiple peripherals +CONFIG_ZMK_SPLIT_BLE_CENTRAL_PERIPHERALS=2 + diff --git a/boards/shields/corne/corne_dongle.overlay b/boards/shields/corne/corne_dongle.overlay new file mode 100644 index 0000000..3eb72b1 --- /dev/null +++ b/boards/shields/corne/corne_dongle.overlay @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + zmk,matrix-transform = &default_transform; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <12>; + rows = <4>; +// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 | +// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 | +// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | + 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,10) RC(1,11) +RC(2,0) RC(2,1) 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,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) + >; + }; + + five_column_transform: keymap_transform_1 { + compatible = "zmk,matrix-transform"; + columns = <10>; + rows = <4>; +// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | +// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | +// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | +// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 | + map = < +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(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,10) +RC(2,1) 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(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) + >; + }; + + kscan0: kscan { + compatible = "zmk,kscan-gpio-direct"; + + input-gpios + = <&xiao_d 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&xiao_d 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&xiao_d 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + , <&xiao_d 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)> + ; + }; + + // TODO: per-key RGB node(s)? +}; diff --git a/boards/shields/corne/corne_left.conf b/boards/shields/corne/corne_left.conf new file mode 100644 index 0000000..e69de29 diff --git a/boards/shields/corne/corne_left.overlay b/boards/shields/corne/corne_left.overlay new file mode 100644 index 0000000..117cb19 --- /dev/null +++ b/boards/shields/corne/corne_left.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include "corne.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 21 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/boards/shields/corne/corne_peripheral_left.conf b/boards/shields/corne/corne_peripheral_left.conf new file mode 100644 index 0000000..e69de29 diff --git a/boards/shields/corne/corne_peripheral_left.overlay b/boards/shields/corne/corne_peripheral_left.overlay new file mode 100644 index 0000000..117cb19 --- /dev/null +++ b/boards/shields/corne/corne_peripheral_left.overlay @@ -0,0 +1,18 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include "corne.dtsi" + +&kscan0 { + col-gpios + = <&pro_micro 21 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 14 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/boards/shields/corne/corne_right.conf b/boards/shields/corne/corne_right.conf new file mode 100644 index 0000000..e69de29 diff --git a/boards/shields/corne/corne_right.overlay b/boards/shields/corne/corne_right.overlay new file mode 100644 index 0000000..a8a0cfe --- /dev/null +++ b/boards/shields/corne/corne_right.overlay @@ -0,0 +1,26 @@ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + +#include "corne.dtsi" + +&default_transform { + col-offset = <6>; +}; + +&five_column_transform { + col-offset = <6>; +}; + +&kscan0 { + col-gpios + = <&pro_micro 14 GPIO_ACTIVE_HIGH> + , <&pro_micro 15 GPIO_ACTIVE_HIGH> + , <&pro_micro 18 GPIO_ACTIVE_HIGH> + , <&pro_micro 19 GPIO_ACTIVE_HIGH> + , <&pro_micro 20 GPIO_ACTIVE_HIGH> + , <&pro_micro 21 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/build.yaml b/build.yaml index 231e981..1f3f33c 100644 --- a/build.yaml +++ b/build.yaml @@ -19,20 +19,20 @@ # --- include: - # xiao_dongle - - board: seeeduino_xiao_ble - shield: corne_dongle_xiao - snippet: studio-rpc-usb-uart - artifact-name: xiao_dongle - # nice_nano_v2 + nice_view - board: nice_nano_v2 shield: corne_left nice_view_adapter nice_view - artifact-name: nice_corne_left_view - board: nice_nano_v2 shield: corne_right nice_view_adapter nice_view - artifact-name: nice_corne_right_view - + + # xiao_dongle + - board: seeeduino_xiao_ble + shield: corne_dongle + # snippet: studio-rpc-usb-uart + # artifact-name: xiao_dongle + - board: nice_nano_v2 + shield: corne_peripheral_left nice_view_adapter nice_view + # reset_settings - board: nice_nano_v2 shield: settings_reset @@ -40,4 +40,3 @@ include: - board: seeeduino_xiao_ble shield: settings_reset artifact-name: xiao_reset_settings - diff --git a/config/west.yml b/config/west.yml index e4d67b1..b886cbe 100644 --- a/config/west.yml +++ b/config/west.yml @@ -4,17 +4,10 @@ manifest: url-base: https://github.com/zmkfirmware # Additional modules containing boards/shields/custom code can be listed here as well # See https://docs.zephyrproject.org/3.2.0/develop/west/manifest.html#projects - # include corne with dongle pro_micro and xiao compatible - - name: mctechnology17 - url-base: https://github.com/mctechnology17 projects: - name: zmk remote: zmkfirmware revision: main import: app/west.yml - # include corne with dongle pro_micro and xiao compatible - - name: zmk-config - remote: mctechnology17 - revision: main self: path: config