diff --git a/boards/shields/phiboard/Kconfig.defconfig b/boards/shields/phiboard/Kconfig.defconfig new file mode 100644 index 0000000..595e86c --- /dev/null +++ b/boards/shields/phiboard/Kconfig.defconfig @@ -0,0 +1,16 @@ +if SHIELD_PHIBOARD_LEFT + +config ZMK_KEYBOARD_NAME + default "phiboard" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +endif # SHIELD_PHIBOARD_LEFT + +if SHIELD_PHIBOARD_LEFT || SHIELD_PHIBOARD_RIGHT + +config ZMK_SPLIT + default y + +endif # SHIELD_PHIBOARD_LEFT || SHIELD_PHIBOARD_RIGHT diff --git a/boards/shields/phiboard/Kconfig.shield b/boards/shields/phiboard/Kconfig.shield new file mode 100644 index 0000000..8afba4c --- /dev/null +++ b/boards/shields/phiboard/Kconfig.shield @@ -0,0 +1,5 @@ +config SHIELD_PHIBOARD_LEFT + def_bool $(shields_list_contains,phiboard_left) + +config SHIELD_PHIBOARD_RIGHT + def_bool $(shields_list_contains,phiboard_right) diff --git a/boards/shields/phiboard/phiboard-layouts.dtsi b/boards/shields/phiboard/phiboard-layouts.dtsi new file mode 100644 index 0000000..2ba9e06 --- /dev/null +++ b/boards/shields/phiboard/phiboard-layouts.dtsi @@ -0,0 +1,23 @@ +// See https://zmk.dev/docs/development/hardware-integration/physical-layouts +// for how to configure this. + +#include + +/ { + default_layout: default_layout { + compatible = "zmk,physical-layout"; + display-name = "Default Layout"; + transform = <&default_transform>; + kscan = <&kscan>; + + // Edit this to define the positions and sizes of the keys, or remove it + // if your keyboard will not support ZMK Studio. + // https://zmk.dev/docs/development/hardware-integration/physical-layouts#optional-keys-property + keys // w h x y rot rx ry + = <&key_physical_attrs 100 100 0 0 0 0 0> + , <&key_physical_attrs 100 100 100 0 0 0 0> + , <&key_physical_attrs 100 100 0 100 0 0 0> + , <&key_physical_attrs 100 100 100 100 0 0 0> + ; + }; +}; diff --git a/boards/shields/phiboard/phiboard.conf b/boards/shields/phiboard/phiboard.conf new file mode 100644 index 0000000..690879f --- /dev/null +++ b/boards/shields/phiboard/phiboard.conf @@ -0,0 +1,13 @@ +# This file was generated from a template. Edit it to match your keyboard. +# See https://zmk.dev/docs/development/hardware-integration/new-shield for more +# instructions. + +# This file will be copied into the user's config directory when they add this +# keyboard. Define any Kconfig options users may frequently want to set here, +# but leave them commented out, for example: + +# Uncomment to enable the encoder +# CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Uncomment to enable the display +# CONFIG_ZMK_DISPLAY=y diff --git a/boards/shields/phiboard/phiboard.dtsi b/boards/shields/phiboard/phiboard.dtsi new file mode 100644 index 0000000..3589292 --- /dev/null +++ b/boards/shields/phiboard/phiboard.dtsi @@ -0,0 +1,46 @@ +// This file was generated from a template. Edit it to match your keyboard. +// See https://zmk.dev/docs/development/hardware-integration/new-shield for more +// instructions. + +#include + +#include "phiboard-layouts.dtsi" + +/ { + chosen { + zmk,physical-layout = &default_layout; + }; + + kscan: kscan { + // If the hardware does not use a switch matrix, change this to the + // appropriate driver and update the properties below to match. + // See https://zmk.dev/docs/config/kscan for supported key scan drivers. + compatible = "zmk,kscan-gpio-matrix"; + // Set this to "col2row" or "row2col" to match the hardware. If using + // "row2col", change the col-gpios in the _left.overlay and _right.overlay + // files to (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN) and the row-gpios here to + // GPIO_ACTIVE_HIGH. + diode-direction = "col2row"; + wakeup-source; + + // Replace these comments with the GPIO pins in the matrix. + // See https://zmk.dev/docs/development/hardware-integration/new-shield#shield-overlays + row-gpios + = <&xiao_d 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&xiao_d 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; + + default_transform: default_transform { + // See https://zmk.dev/docs/development/hardware-integration/new-shield#matrix-transform + // for how to configure this + compatible = "zmk,matrix-transform"; + columns = <4>; + rows = <2>; + + map = < + RC(0, 0) RC(0, 1) RC(0, 2) RC(0, 3) + RC(1, 0) RC(1, 1) RC(1, 2) RC(1, 3) + >; + }; +}; diff --git a/boards/shields/phiboard/phiboard.keymap b/boards/shields/phiboard/phiboard.keymap new file mode 100644 index 0000000..0c9e1be --- /dev/null +++ b/boards/shields/phiboard/phiboard.keymap @@ -0,0 +1,20 @@ +// This file was generated from a template. Edit it to match your keyboard. +// See https://zmk.dev/docs/development/hardware-integration/new-shield for more instructions. + +#include +#include + +/ { + // Define a default keymap here. + // See https://zmk.dev/docs/development/hardware-integration/new-shield#default-keymap. + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp N1 &kp N2 &kp N3 &kp N4 + &kp A &kp B &kp C &kp D + >; + }; + }; +}; diff --git a/boards/shields/phiboard/phiboard.zmk.yml b/boards/shields/phiboard/phiboard.zmk.yml new file mode 100644 index 0000000..1a1d302 --- /dev/null +++ b/boards/shields/phiboard/phiboard.zmk.yml @@ -0,0 +1,19 @@ +# This file was generated from a template. Edit it to match your keyboard. +# See https://zmk.dev/docs/development/hardware-integration/hardware-metadata-files +# for instructions. + +file_format: "1" +id: phiboard +name: phiboard +type: shield + +# Set this to a URL that documents the keyboard. +url: https://example.com + +# Add any features your keyboard supports here. +# See https://zmk.dev/docs/development/hardware-integration/hardware-metadata-files#features +features: + - keys + - studio # Remove this line if your keyboard will not support ZMK Studio +requires: + - seeed_xiao diff --git a/boards/shields/phiboard/phiboard_left.overlay b/boards/shields/phiboard/phiboard_left.overlay new file mode 100644 index 0000000..2eb6c7a --- /dev/null +++ b/boards/shields/phiboard/phiboard_left.overlay @@ -0,0 +1,14 @@ +// This file was generated from a template. Edit it to match your keyboard. +// See https://zmk.dev/docs/development/hardware-integration/new-shield for more +// instructions. + +#include "phiboard.dtsi" + +&kscan { + // Replace these comments with the GPIO pins in the matrix for the left side. + // See https://zmk.dev/docs/development/hardware-integration/new-shield#shield-overlays + col-gpios + = <&xiao_d 0 GPIO_ACTIVE_HIGH> + , <&xiao_d 0 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/boards/shields/phiboard/phiboard_right.overlay b/boards/shields/phiboard/phiboard_right.overlay new file mode 100644 index 0000000..f165a26 --- /dev/null +++ b/boards/shields/phiboard/phiboard_right.overlay @@ -0,0 +1,19 @@ +// This file was generated from a template. Edit it to match your keyboard. +// See https://zmk.dev/docs/development/hardware-integration/new-shield for more +// instructions. + +#include "phiboard.dtsi" + +&default_transform { + // Set this to the number of columns on the left side. + col-offset = <2>; +}; + +&kscan { + // Replace these comments with the GPIO pins in the matrix for the right side. + // See https://zmk.dev/docs/development/hardware-integration/new-shield#shield-overlays + col-gpios + = <&xiao_d 0 GPIO_ACTIVE_HIGH> + , <&xiao_d 0 GPIO_ACTIVE_HIGH> + ; +}; diff --git a/build.yaml b/build.yaml new file mode 100644 index 0000000..8f6b3c9 --- /dev/null +++ b/build.yaml @@ -0,0 +1,22 @@ +# This file generates the GitHub Actions matrix. +# For simple board + shield combinations, add them to the top level board and +# shield arrays, for more control, add individual board + shield combinations +# to the `include` property. You can also use the `cmake-args` property to +# pass flags to the build command, `snippet` to add a Zephyr snippet, and +# `artifact-name` to assign a name to distinguish build outputs from each other: +# +# board: [ "nice_nano_v2" ] +# shield: [ "corne_left", "corne_right" ] +# include: +# - board: bdn9_rev2 +# - board: nice_nano_v2 +# shield: reviung41 +# - board: nice_nano_v2 +# shield: corne_left +# snippet: studio-rpc-usb-uart +# cmake-args: -DCONFIG_ZMK_STUDIO=y +# artifact-name: corne_left_with_studio +# +--- +null +... diff --git a/config/west.yml b/config/west.yml new file mode 100644 index 0000000..88c6c13 --- /dev/null +++ b/config/west.yml @@ -0,0 +1,14 @@ +manifest: + defaults: + revision: v0.2 + remotes: + - name: zmkfirmware + 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 + projects: + - name: zmk + remote: zmkfirmware + import: app/west.yml + self: + path: config diff --git a/zephyr/module.yml b/zephyr/module.yml new file mode 100644 index 0000000..1cc2b35 --- /dev/null +++ b/zephyr/module.yml @@ -0,0 +1,3 @@ +build: + settings: + board_root: .