zmk_build

ZMK code & build repository
git clone https://git.pngu.org/zmk_build
Log | Files | Refs | Submodules | README

commit f51ccf7960d06e887bd30a641252b7180f936d67
parent bc836906cc4ff53463329216b40c6cff110c4210
Author: Jack Sangdahl <jack@pngu.org>
Date:   Mon, 18 May 2026 08:28:10 +0300

Add initial sweepable firmware

Diffstat:
Asweepable/boards/sweepable/Kconfig.defconfig | 35+++++++++++++++++++++++++++++++++++
Asweepable/boards/sweepable/Kconfig.sweepable_left | 6++++++
Asweepable/boards/sweepable/Kconfig.sweepable_right | 6++++++
Asweepable/boards/sweepable/board.cmake | 6++++++
Asweepable/boards/sweepable/board.yml | 21+++++++++++++++++++++
Asweepable/boards/sweepable/pre_dt_board.cmake | 7+++++++
Asweepable/boards/sweepable/sweepable-pinctrl.dtsi | 22++++++++++++++++++++++
Asweepable/boards/sweepable/sweepable.dtsi | 103+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asweepable/boards/sweepable/sweepable.keymap | 20++++++++++++++++++++
Asweepable/boards/sweepable/sweepable.yaml | 17+++++++++++++++++
Asweepable/boards/sweepable/sweepable.zmk.yml | 16++++++++++++++++
Asweepable/boards/sweepable/sweepable_left.dts | 27+++++++++++++++++++++++++++
Asweepable/boards/sweepable/sweepable_left_defconfig | 37+++++++++++++++++++++++++++++++++++++
Asweepable/boards/sweepable/sweepable_right.dts | 31+++++++++++++++++++++++++++++++
Asweepable/boards/sweepable/sweepable_right_defconfig | 37+++++++++++++++++++++++++++++++++++++
Asweepable/zephyr/module.yml | 4++++
16 files changed, 395 insertions(+), 0 deletions(-)

diff --git a/sweepable/boards/sweepable/Kconfig.defconfig b/sweepable/boards/sweepable/Kconfig.defconfig @@ -0,0 +1,35 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +if BOARD_SWEEPABLE_LEFT + +config ZMK_KEYBOARD_NAME + default "Sweepable" + +config ZMK_SPLIT_ROLE_CENTRAL + default y + +endif # BOARD_SWEEPABLE_LEFT + +if BOARD_SWEEPABLE_LEFT || BOARD_SWEEPABLE_RIGHT + +config BOARD + default "sweepable" + +config ZMK_SPLIT + default y + +config BT_CTLR + default BT + +if USB + +config USB_NRFX + default y + +config USB_DEVICE_STACK + default y + +endif # USB + +endif # BOARD_SWEEPABLE_LEFT || BOARD_SWEEPABLE_RIGHT diff --git a/sweepable/boards/sweepable/Kconfig.sweepable_left b/sweepable/boards/sweepable/Kconfig.sweepable_left @@ -0,0 +1,6 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +config BOARD_SWEEPABLE_LEFT + select SOC_NRF52840_QIAA + select ZMK_BOARD_COMPAT diff --git a/sweepable/boards/sweepable/Kconfig.sweepable_right b/sweepable/boards/sweepable/Kconfig.sweepable_right @@ -0,0 +1,6 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +config BOARD_SWEEPABLE_RIGHT + select SOC_NRF52840_QIAA + select ZMK_BOARD_COMPAT diff --git a/sweepable/boards/sweepable/board.cmake b/sweepable/boards/sweepable/board.cmake @@ -0,0 +1,6 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset") +include(${ZEPHYR_BASE}/boards/common/uf2.board.cmake) +include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake) diff --git a/sweepable/boards/sweepable/board.yml b/sweepable/boards/sweepable/board.yml @@ -0,0 +1,21 @@ +boards: + - name: sweepable_left + vendor: pngu.org + socs: + - name: nrf52840 + revision: + format: major.minor.patch + default: 1.0.0 + exact: false + revisions: + - name: 1.0.0 + - name: sweepable_right + vendor: pngu.org + socs: + - name: nrf52840 + revision: + format: major.minor.patch + default: 1.0.0 + exact: false + revisions: + - name: 1.0.0 diff --git a/sweepable/boards/sweepable/pre_dt_board.cmake b/sweepable/boards/sweepable/pre_dt_board.cmake @@ -0,0 +1,7 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +# Suppresses duplicate unit-address warning at build time for power, clock, acl and flash-controller +# https://docs.zephyrproject.org/latest/build/dts/intro-input-output.html + +list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled") diff --git a/sweepable/boards/sweepable/sweepable-pinctrl.dtsi b/sweepable/boards/sweepable/sweepable-pinctrl.dtsi @@ -0,0 +1,22 @@ +// Copyright (c) 2026 jack@pngu.org +// SPDX-License-Identifier: MIT + +&pinctrl { + i2c0_default: i2c0_default { + group1 { + psels = <NRF_PSEL(TWIM_SDA, 0, 7)>, + <NRF_PSEL(TWIM_SCL, 0, 5)>; + bias-pull-up; + }; + }; + + i2c0_sleep: i2c0_sleep { + group1 { + psels = <NRF_PSEL(TWIM_SDA, 0, 7)>, + <NRF_PSEL(TWIM_SCL, 0, 5)>; + low-power-enable; + bias-pull-up; + }; + }; +}; + diff --git a/sweepable/boards/sweepable/sweepable.dtsi b/sweepable/boards/sweepable/sweepable.dtsi @@ -0,0 +1,103 @@ +// Copyright (c) 2026 jack@pngu.org +// SPDX-License-Identifier: MIT + +/dts-v1/; +#include <nordic/nrf52840_qiaa.dtsi> +#include "sweepable-pinctrl.dtsi" +#include <layouts/cuddlykeyboards/ferris.dtsi> +#include <dt-bindings/zmk/matrix_transform.h> + +&cuddlykeyboards_ferris_layout { + transform = <&default_transform>; +}; + +/ { + model = "Sweepable"; + compatible = "sweepable"; + + chosen { + zephyr,code-partition = &code_partition; + zephyr,sram = &sram0; + zephyr,flash = &flash0; + zmk,kscan = &kscan0; + zmk,battery = &battery_gauge; + zmk,physical-layout = &cuddlykeyboards_ferris_layout; + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <10>; + rows = <4>; + 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) + >; + }; + + leds { + compatible = "gpio-leds"; + status_led: led_0 { + gpios = <&gpio1 9 GPIO_ACTIVE_HIGH>; + }; + }; +}; + +&gpiote { + status = "okay"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +zephyr_udc0: &usbd { + status = "okay"; +}; + +&flash0 { + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + sd_partition: partition@0 { + label = "mbr"; + reg = <0x00000000 0x00001000>; + }; + + code_partition: partition@1000 { + label = "code_partition"; + reg = <0x00001000 0x000d3000>; + }; + + storage_partition: partition@d4000 { + label = "storage"; + reg = <0x000d4000 0x00020000>; + }; + + boot_partition: partition@f4000 { + label = "adafruit_boot"; + reg = <0x000f4000 0x0000c000>; + }; + }; +}; + +&i2c0 { + status = "okay"; + compatible = "nordic,nrf-twi"; + pinctrl-0 = <&i2c0_default>; + pinctrl-1 = <&i2c0_sleep>; + pinctrl-names = "default", "sleep"; + + battery_gauge: max17048@36 { + compatible = "zmk,maxim-max17048"; + status = "okay"; + reg = <0x36>; + }; +}; diff --git a/sweepable/boards/sweepable/sweepable.keymap b/sweepable/boards/sweepable/sweepable.keymap @@ -0,0 +1,20 @@ +// Copyright (c) 2026 jack@pngu.org +// SPDX-License-Identifier: MIT + +#include <behaviors.dtsi> +#include <dt-bindings/zmk/keys.h> + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P + &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI + &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH + &kp LGUI &kp SPACE &kp BSPC &kp RALT + >; + }; + }; +}; diff --git a/sweepable/boards/sweepable/sweepable.yaml b/sweepable/boards/sweepable/sweepable.yaml @@ -0,0 +1,17 @@ +identifier: sweepable +name: Sweepable +url: https://git.pngu.org/sweepable +type: mcu +arch: arm +toolchain: + - zephyr + - gnuarmemb + - xtools +ram: 40 +supported: + - usb_device + - ble + - ieee802154 + - watchdog + - gpio + - i2c diff --git a/sweepable/boards/sweepable/sweepable.zmk.yml b/sweepable/boards/sweepable/sweepable.zmk.yml @@ -0,0 +1,16 @@ +file_format: "1" +id: sweepable +name: Sweepable +url: https://git.pngu.org/sweepable +type: board +arch: arm +features: + - keys +outputs: + - usb + - ble +revisions: + - 1.0.0 +siblings: + - sweepable_left + - sweepable_right diff --git a/sweepable/boards/sweepable/sweepable_left.dts b/sweepable/boards/sweepable/sweepable_left.dts @@ -0,0 +1,27 @@ +// Copyright (c) 2026 jack@pngu.org +// SPDX-License-Identifier: MIT + +#include "sweepable.dtsi" + +/{ + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + wakeup-source; + + diode-direction = "col2row"; + row-gpios + = <&gpio1 29 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 30 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 31 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + col-gpios + = <&gpio0 28 GPIO_ACTIVE_HIGH> + , <&gpio0 2 GPIO_ACTIVE_HIGH> + , <&gpio0 3 GPIO_ACTIVE_HIGH> + , <&gpio1 15 GPIO_ACTIVE_HIGH> + , <&gpio1 13 GPIO_ACTIVE_HIGH> + ; + }; +}; diff --git a/sweepable/boards/sweepable/sweepable_left_defconfig b/sweepable/boards/sweepable/sweepable_left_defconfig @@ -0,0 +1,37 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable pinctrl +CONFIG_PINCTRL=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable I2C +CONFIG_I2C=y + +# Enable battery gauge driver +CONFIG_ZMK_MAX17048=y + +# Enable writing to flash +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 + +# Enable 32kHz crystal +CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y + +# Enable USB on left half +CONFIG_ZMK_USB=y + +CONFIG_ZMK_BLE=y +CONFIG_ZMK_SLEEP=y diff --git a/sweepable/boards/sweepable/sweepable_right.dts b/sweepable/boards/sweepable/sweepable_right.dts @@ -0,0 +1,31 @@ +// Copyright (c) 2026 jack@pngu.org +// SPDX-License-Identifier: MIT + +#include "sweepable.dtsi" + +/{ + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + wakeup-source; + + diode-direction = "col2row"; + row-gpios + = <&gpio0 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + col-gpios + = <&gpio1 6 GPIO_ACTIVE_HIGH> + , <&gpio1 4 GPIO_ACTIVE_HIGH> + , <&gpio1 2 GPIO_ACTIVE_HIGH> + , <&gpio1 1 GPIO_ACTIVE_HIGH> + , <&gpio1 3 GPIO_ACTIVE_HIGH> + ; + }; +}; + +&default_transform { + col-offset = <5>; +}; diff --git a/sweepable/boards/sweepable/sweepable_right_defconfig b/sweepable/boards/sweepable/sweepable_right_defconfig @@ -0,0 +1,37 @@ +# Copyright (c) 2026 jack@pngu.org +# SPDX-License-Identifier: MIT + +# Enable MPU +CONFIG_ARM_MPU=y + +# Enable pinctrl +CONFIG_PINCTRL=y + +# Enable GPIO +CONFIG_GPIO=y + +# Enable I2C +CONFIG_I2C=y + +# Enable battery gauge driver +CONFIG_ZMK_MAX17048=y + +# Enable writing to flash +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 + +# Enable 32kHz crystal +CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y +CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y + +# Do not enable USB on right half +CONFIG_ZMK_USB=n + +CONFIG_ZMK_BLE=y +CONFIG_ZMK_SLEEP=y diff --git a/sweepable/zephyr/module.yml b/sweepable/zephyr/module.yml @@ -0,0 +1,4 @@ +name: sweepable +build: + settings: + board_root: .