feat(boards/shields): Add settings for Rpi Pico and add tester_rpi_pico shield (#2900)

* feat(boards): Properly support settings for RPi Pico board.

* feat(shields): Add a tester_rpi_pico shield

---------

Co-authored-by: Peter Johanson <peter@peterjohanson.com>
This commit is contained in:
Nicolas Munnich 2025-08-10 22:00:35 +01:00 committed by GitHub
parent c7fae18ae1
commit ccf20a1f5c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 277 additions and 0 deletions

View File

@ -3,3 +3,10 @@ CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_UART_INTERRUPT_DRIVEN=n
CONFIG_ZMK_USB=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

View File

@ -0,0 +1,15 @@
&uart0 { status = "disabled"; };
&code_partition {
reg = <0x100 (DT_SIZE_M(2) - 0x100 - DT_SIZE_K(512))>;
};
&flash0 {
partitions {
storage_partition: partition@180000 {
reg = <0x180000 DT_SIZE_K(512)>;
read-only;
};
};
};

View File

@ -0,0 +1,12 @@
if SHIELD_TESTER_RPI_PICO
config ZMK_KEYBOARD_NAME
default "ZMK Tester"
config ZMK_BLE
def_bool n
config SETTINGS
def_bool n
endif

View File

@ -0,0 +1,2 @@
config SHIELD_TESTER_RPI_PICO
def_bool $(shields_list_contains,tester_rpi_pico)

View File

@ -0,0 +1,95 @@
/*
* Copyright (c) 2025 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <physical_layouts.dtsi>
/ {
tester_position_map {
compatible = "zmk,physical-layout-position-map";
complete;
pinout_map: pinout_positions {
physical-layout = <&physical_layout0>;
positions = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25>;
};
inline_map: single_row_positions {
physical-layout = <&physical_layout1>;
positions = <0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25>;
};
};
physical_layout0: physical_layout_0 {
compatible = "zmk,physical-layout";
display-name = "Rpi Pico Pinout";
kscan = <&kscan0>;
transform = <&matrix_transform0>;
keys // w h x y rot rx ry
= <&key_physical_attrs 100 100 0 0 0 0 0>
, <&key_physical_attrs 100 100 0 100 0 0 0>
, <&key_physical_attrs 100 100 0 300 0 0 0>
, <&key_physical_attrs 100 100 0 400 0 0 0>
, <&key_physical_attrs 100 100 0 500 0 0 0>
, <&key_physical_attrs 100 100 0 600 0 0 0>
, <&key_physical_attrs 100 100 0 800 0 0 0>
, <&key_physical_attrs 100 100 0 900 0 0 0>
, <&key_physical_attrs 100 100 0 1000 0 0 0>
, <&key_physical_attrs 100 100 0 1100 0 0 0>
, <&key_physical_attrs 100 100 0 1300 0 0 0>
, <&key_physical_attrs 100 100 0 1400 0 0 0>
, <&key_physical_attrs 100 100 0 1500 0 0 0>
, <&key_physical_attrs 100 100 0 1600 0 0 0>
, <&key_physical_attrs 100 100 0 1800 0 0 0>
, <&key_physical_attrs 100 100 0 1900 0 0 0>
, <&key_physical_attrs 100 100 600 1900 0 0 0>
, <&key_physical_attrs 100 100 600 1800 0 0 0>
, <&key_physical_attrs 100 100 600 1600 0 0 0>
, <&key_physical_attrs 100 100 600 1500 0 0 0>
, <&key_physical_attrs 100 100 600 1400 0 0 0>
, <&key_physical_attrs 100 100 600 1300 0 0 0>
, <&key_physical_attrs 100 100 600 1100 0 0 0>
, <&key_physical_attrs 100 100 600 900 0 0 0>
, <&key_physical_attrs 100 100 600 800 0 0 0>
, <&key_physical_attrs 100 100 600 600 0 0 0>
;
};
physical_layout1: physical_layout_1 {
compatible = "zmk,physical-layout";
display-name = "Single Row";
// Single row of eighteen "keys", in ascending "Arduino" order.
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 200 0 0 0 0>
, <&key_physical_attrs 100 100 300 0 0 0 0>
, <&key_physical_attrs 100 100 400 0 0 0 0>
, <&key_physical_attrs 100 100 500 0 0 0 0>
, <&key_physical_attrs 100 100 600 0 0 0 0>
, <&key_physical_attrs 100 100 700 0 0 0 0>
, <&key_physical_attrs 100 100 800 0 0 0 0>
, <&key_physical_attrs 100 100 900 0 0 0 0>
, <&key_physical_attrs 100 100 1000 0 0 0 0>
, <&key_physical_attrs 100 100 1100 0 0 0 0>
, <&key_physical_attrs 100 100 1200 0 0 0 0>
, <&key_physical_attrs 100 100 1300 0 0 0 0>
, <&key_physical_attrs 100 100 1400 0 0 0 0>
, <&key_physical_attrs 100 100 1500 0 0 0 0>
, <&key_physical_attrs 100 100 1600 0 0 0 0>
, <&key_physical_attrs 100 100 1700 0 0 0 0>
, <&key_physical_attrs 100 100 1800 0 0 0 0>
, <&key_physical_attrs 100 100 1900 0 0 0 0>
, <&key_physical_attrs 100 100 2000 0 0 0 0>
, <&key_physical_attrs 100 100 2100 0 0 0 0>
, <&key_physical_attrs 100 100 2200 0 0 0 0>
, <&key_physical_attrs 100 100 2300 0 0 0 0>
, <&key_physical_attrs 100 100 2400 0 0 0 0>
, <&key_physical_attrs 100 100 2500 0 0 0 0>
;
};
};

View File

@ -0,0 +1,77 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#define PIN_MACRO(name, pin) \
/ { \
macros { \
name: name { \
compatible = "zmk,behavior-macro"; \
wait-ms = <5>; \
tap-ms = <5>; \
#binding-cells = <0>; \
bindings = <&kp P &kp I &kp N &kp SPACE>, pin, <&kp ENTER>; \
}; \
}; \
};
PIN_MACRO(pin0, <&kp N0>)
PIN_MACRO(pin1, <&kp N1>)
PIN_MACRO(pin2, <&kp N2>)
PIN_MACRO(pin3, <&kp N3>)
PIN_MACRO(pin4, <&kp N4>)
PIN_MACRO(pin5, <&kp N5>)
PIN_MACRO(pin6, <&kp N6>)
PIN_MACRO(pin7, <&kp N7>)
PIN_MACRO(pin8, <&kp N8>)
PIN_MACRO(pin9, <&kp N9>)
PIN_MACRO(pin10, <&kp N1 &kp N0>)
PIN_MACRO(pin11, <&kp N1 &kp N1>)
PIN_MACRO(pin12, <&kp N1 &kp N2>)
PIN_MACRO(pin13, <&kp N1 &kp N3>)
PIN_MACRO(pin14, <&kp N1 &kp N4>)
PIN_MACRO(pin15, <&kp N1 &kp N5>)
PIN_MACRO(pin16, <&kp N1 &kp N6>)
PIN_MACRO(pin17, <&kp N1 &kp N7>)
PIN_MACRO(pin18, <&kp N1 &kp N8>)
PIN_MACRO(pin19, <&kp N1 &kp N9>)
PIN_MACRO(pin20, <&kp N2 &kp N0>)
PIN_MACRO(pin21, <&kp N2 &kp N1>)
PIN_MACRO(pin22, <&kp N2 &kp N2>)
PIN_MACRO(pin26, <&kp N2 &kp N6>)
PIN_MACRO(pin27, <&kp N2 &kp N7>)
PIN_MACRO(pin28, <&kp N2 &kp N8>)
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <&pin0
&pin1
&pin2
&pin3
&pin4
&pin5
&pin6
&pin7
&pin8
&pin9
&pin10
&pin11
&pin12
&pin13
&pin14
&pin15
&pin16
&pin17
&pin18
&pin19
&pin20
&pin21
&pin22
&pin26
&pin27
&pin28>;
};
};
};

View File

@ -0,0 +1,63 @@
#include <dt-bindings/zmk/matrix_transform.h>
#include "tester_rpi_pico-layouts.dtsi"
&physical_layout0 {
transform = <&transform0>;
};
&physical_layout1 {
transform = <&transform0>;
};
/ {
chosen {
zmk,kscan = &kscan0;
zmk,physical-layout = &physical_layout0;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-direct";
wakeup-source;
debounce-press-ms = <10>;
debounce-release-ms = <10>;
input-gpios
= <&pico_header 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 5 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 7 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 11 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 12 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 15 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 17 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 22 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 26 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 27 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&pico_header 28 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};
transform0: keymap_transform {
compatible = "zmk,matrix-transform";
columns = <26>;
rows = <1>;
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(0,12) RC(0,13) RC(0,14) RC(0,15) RC(0,16) RC(0,17) RC(0,18) RC(0,19)
RC(0,20) RC(0,21) RC(0,22) RC(0,23) RC(0,24) RC(0,25)
>;
};
};

View File

@ -0,0 +1,6 @@
file_format: "1"
id: tester_rpi_pico
name: TesterRpiPico
type: shield
url: https://zmk.dev/docs/troubleshooting/hardware-issues
requires: [rpi_pico]