From caa74aa28aae13264b6fb26d1af341b41d1d643d Mon Sep 17 00:00:00 2001 From: Peter Johanson Date: Thu, 8 Aug 2024 16:23:11 -0600 Subject: [PATCH] feat: Add posix_pro_micro and posix_seeed_xiao shields * Make it easier to test native builds of our shields by adding `posix_pro_micro` and `posix_seeed_xiao` so you can build posix target of, e.g. `corne_left` for testing ZMK Studio. --- app/boards/native_posix_64.overlay | 2 +- .../shields/posix_pro_micro/Kconfig.defconfig | 9 ++++ .../shields/posix_pro_micro/Kconfig.shield | 5 ++ .../posix_pro_micro/posix_pro_micro.overlay | 51 +++++++++++++++++++ .../posix_seeed_xiao/Kconfig.defconfig | 9 ++++ .../shields/posix_seeed_xiao/Kconfig.shield | 5 ++ .../posix_seeed_xiao/posix_seeed_xiao.overlay | 44 ++++++++++++++++ 7 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 app/boards/shields/posix_pro_micro/Kconfig.defconfig create mode 100644 app/boards/shields/posix_pro_micro/Kconfig.shield create mode 100644 app/boards/shields/posix_pro_micro/posix_pro_micro.overlay create mode 100644 app/boards/shields/posix_seeed_xiao/Kconfig.defconfig create mode 100644 app/boards/shields/posix_seeed_xiao/Kconfig.shield create mode 100644 app/boards/shields/posix_seeed_xiao/posix_seeed_xiao.overlay diff --git a/app/boards/native_posix_64.overlay b/app/boards/native_posix_64.overlay index 2e571c4b71d0..5b8e23d3087e 100644 --- a/app/boards/native_posix_64.overlay +++ b/app/boards/native_posix_64.overlay @@ -8,7 +8,7 @@ zmk,kscan = &kscan; }; - kscan: kscan { + kscan: native_posix_64_kscan_mock { compatible = "zmk,kscan-mock"; rows = <2>; diff --git a/app/boards/shields/posix_pro_micro/Kconfig.defconfig b/app/boards/shields/posix_pro_micro/Kconfig.defconfig new file mode 100644 index 000000000000..5e34fbe5420f --- /dev/null +++ b/app/boards/shields/posix_pro_micro/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_POSIX_PRO_MICRO + +config ZMK_STUDIO + select UART_NATIVE_POSIX_PORT_1_ENABLE + +endif \ No newline at end of file diff --git a/app/boards/shields/posix_pro_micro/Kconfig.shield b/app/boards/shields/posix_pro_micro/Kconfig.shield new file mode 100644 index 000000000000..004fbe4d3e62 --- /dev/null +++ b/app/boards/shields/posix_pro_micro/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_POSIX_PRO_MICRO + def_bool $(shields_list_contains,posix_pro_micro) diff --git a/app/boards/shields/posix_pro_micro/posix_pro_micro.overlay b/app/boards/shields/posix_pro_micro/posix_pro_micro.overlay new file mode 100644 index 000000000000..e3677f53d878 --- /dev/null +++ b/app/boards/shields/posix_pro_micro/posix_pro_micro.overlay @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + + /delete-node/ &kscan; + + &uart1 { status = "okay"; }; + + / { + chosen { + zmk,studio-rpc-uart = &uart1; + }; + + pro_micro: connector { + compatible = "arduino-pro-micro"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 0 0> /* D0 */ + , <1 0 &gpio0 1 0> /* D1 */ + , <2 0 &gpio0 2 0> /* D2 */ + , <3 0 &gpio0 3 0> /* D3 */ + , <4 0 &gpio0 4 0> /* D4/A6 */ + , <5 0 &gpio0 5 0> /* D5 */ + , <6 0 &gpio0 6 0> /* D6/A7 */ + , <7 0 &gpio0 7 0> /* D7 */ + , <8 0 &gpio0 8 0> /* D8/A8 */ + , <9 0 &gpio0 9 0> /* D9/A9 */ + , <10 0 &gpio0 10 0> /* D10/A10 */ + , <16 0 &gpio0 11 0> /* D16 */ + , <14 0 &gpio0 12 0> /* D14 */ + , <15 0 &gpio0 13 0> /* D15 */ + , <18 0 &gpio0 14 0> /* D18/A0 */ + , <19 0 &gpio0 15 0> /* D19/A1 */ + , <20 0 &gpio0 16 0> /* D20/A2 */ + , <21 0 &gpio0 17 0> /* D21/A3 */ + ; + }; +}; + +pro_micro_i2c: &i2c0 {}; +pro_micro_spi: &spi0 {}; +pro_micro_serial: &uart0 {}; diff --git a/app/boards/shields/posix_seeed_xiao/Kconfig.defconfig b/app/boards/shields/posix_seeed_xiao/Kconfig.defconfig new file mode 100644 index 000000000000..b21448c2db36 --- /dev/null +++ b/app/boards/shields/posix_seeed_xiao/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_POSIX_SEEED_XIAO + +config ZMK_STUDIO + select UART_NATIVE_POSIX_PORT_1_ENABLE + +endif \ No newline at end of file diff --git a/app/boards/shields/posix_seeed_xiao/Kconfig.shield b/app/boards/shields/posix_seeed_xiao/Kconfig.shield new file mode 100644 index 000000000000..da193107bcaf --- /dev/null +++ b/app/boards/shields/posix_seeed_xiao/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_POSIX_SEEED_XIAO + def_bool $(shields_list_contains,posix_seeed_xiao) diff --git a/app/boards/shields/posix_seeed_xiao/posix_seeed_xiao.overlay b/app/boards/shields/posix_seeed_xiao/posix_seeed_xiao.overlay new file mode 100644 index 000000000000..f8406dd49ebb --- /dev/null +++ b/app/boards/shields/posix_seeed_xiao/posix_seeed_xiao.overlay @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2024 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ +/* + * Copyright (c) 2020 Pete Johanson + * + * SPDX-License-Identifier: MIT + */ + + /delete-node/ &kscan; + + &uart1 { status = "okay"; }; + + / { + chosen { + zmk,studio-rpc-uart = &uart1; + }; + + xiao_d: connector { + compatible = "seeed,xiao-gpio"; + #gpio-cells = <2>; + gpio-map-mask = <0xffffffff 0xffffffc0>; + gpio-map-pass-thru = <0 0x3f>; + gpio-map + = <0 0 &gpio0 0 0> /* D0 */ + , <1 0 &gpio0 1 0> /* D1 */ + , <2 0 &gpio0 2 0> /* D2 */ + , <3 0 &gpio0 3 0> /* D3 */ + , <4 0 &gpio0 4 0> /* D4 */ + , <5 0 &gpio0 5 0> /* D5 */ + , <6 0 &gpio0 6 0> /* D6 */ + , <7 0 &gpio0 7 0> /* D7 */ + , <8 0 &gpio0 8 0> /* D8 */ + , <9 0 &gpio0 9 0> /* D9 */ + , <10 0 &gpio0 10 0> /* D10 */ + ; + }; +}; + +xiao_i2c: &i2c0 {}; +xiao_spi: &spi0 {}; +xiao_serial: &uart0 {}; \ No newline at end of file