From 7e0ed6c688503b393086e83891cfc7799d0c2c81 Mon Sep 17 00:00:00 2001 From: Nick Winans Date: Fri, 28 Jan 2022 11:25:20 -0600 Subject: [PATCH] feat(boards): Add 1up sweet 16 macropad --- app/boards/shields/sweet16/Kconfig.defconfig | 9 ++++ app/boards/shields/sweet16/Kconfig.shield | 5 +++ .../sweet16/boards/nice_nano_2.overlay | 28 ++++++++++++ app/boards/shields/sweet16/sweet16.conf | 3 ++ app/boards/shields/sweet16/sweet16.keymap | 44 +++++++++++++++++++ app/boards/shields/sweet16/sweet16.overlay | 33 ++++++++++++++ app/boards/shields/sweet16/sweet16.zmk.yml | 9 ++++ 7 files changed, 131 insertions(+) create mode 100644 app/boards/shields/sweet16/Kconfig.defconfig create mode 100644 app/boards/shields/sweet16/Kconfig.shield create mode 100644 app/boards/shields/sweet16/boards/nice_nano_2.overlay create mode 100644 app/boards/shields/sweet16/sweet16.conf create mode 100644 app/boards/shields/sweet16/sweet16.keymap create mode 100644 app/boards/shields/sweet16/sweet16.overlay create mode 100644 app/boards/shields/sweet16/sweet16.zmk.yml diff --git a/app/boards/shields/sweet16/Kconfig.defconfig b/app/boards/shields/sweet16/Kconfig.defconfig new file mode 100644 index 00000000..cc4efaa2 --- /dev/null +++ b/app/boards/shields/sweet16/Kconfig.defconfig @@ -0,0 +1,9 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_SWEET16 + +config ZMK_KEYBOARD_NAME + default "Sweet 16" + +endif diff --git a/app/boards/shields/sweet16/Kconfig.shield b/app/boards/shields/sweet16/Kconfig.shield new file mode 100644 index 00000000..fc396b29 --- /dev/null +++ b/app/boards/shields/sweet16/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2022 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_SWEET16 + def_bool $(shields_list_contains,sweet16) diff --git a/app/boards/shields/sweet16/boards/nice_nano_2.overlay b/app/boards/shields/sweet16/boards/nice_nano_2.overlay new file mode 100644 index 00000000..4c1ab5ee --- /dev/null +++ b/app/boards/shields/sweet16/boards/nice_nano_2.overlay @@ -0,0 +1,28 @@ +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <45>; + // Unused pins, needed for SPI definition, but not used by the ws2812 driver itself. + sck-pin = <5>; + miso-pin = <7>; + + led_strip: ws2812@0 { + compatible = "worldsemi,ws2812-spi"; + label = "WS2812"; + + /* SPI */ + reg = <0>; /* ignored, but necessary for SPI bindings */ + spi-max-frequency = <4000000>; + + /* WS2812 */ + chain-length = <12>; /* arbitrary; change at will */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/app/boards/shields/sweet16/sweet16.conf b/app/boards/shields/sweet16/sweet16.conf new file mode 100644 index 00000000..289f070b --- /dev/null +++ b/app/boards/shields/sweet16/sweet16.conf @@ -0,0 +1,3 @@ +# Uncomment the following lines to enable RGB underglow +# CONFIG_ZMK_RGB_UNDERGLOW=y +# CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/sweet16/sweet16.keymap b/app/boards/shields/sweet16/sweet16.keymap new file mode 100644 index 00000000..ed83bd0d --- /dev/null +++ b/app/boards/shields/sweet16/sweet16.keymap @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +/ { + keymap { + compatible = "zmk,keymap"; + + default_layer { +// -------------------------- +// | 7 | 8 | 9 | * | +// | 4 | 5 | 6 | / | +// | 1 | 2 | 3 | - | +// | 0 | ENT | LWR | = | + bindings = < + &kp N7 &kp N8 &kp N9 &kp ASTERISK + &kp N4 &kp N5 &kp N6 &kp SLASH + &kp N1 &kp N2 &kp N3 &kp MINUS + &kp N0 &kp ENTER &mo 1 &kp EQUAL + >; + }; + + lower_layer { +// ------------------------ +// | BT1 | BT2 | BT3 | BT4 | +// | | | | | +// | | | | | +// | | | |BTCLR| + bindings = < + &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 + &none &none &none &none + &none &none &none &none + &none &none &trans &bt BT_CLR + >; + }; + }; +}; diff --git a/app/boards/shields/sweet16/sweet16.overlay b/app/boards/shields/sweet16/sweet16.overlay new file mode 100644 index 00000000..1d80b999 --- /dev/null +++ b/app/boards/shields/sweet16/sweet16.overlay @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2022 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + chosen { + zmk,kscan = &kscan0; + }; + + kscan0: kscan_0 { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + diode-direction = "col2row"; + + col-gpios + = <&pro_micro 2 GPIO_ACTIVE_HIGH> + , <&pro_micro 3 GPIO_ACTIVE_HIGH> + , <&pro_micro 4 GPIO_ACTIVE_HIGH> + , <&pro_micro 5 GPIO_ACTIVE_HIGH> + ; + + row-gpios + = <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + }; +}; diff --git a/app/boards/shields/sweet16/sweet16.zmk.yml b/app/boards/shields/sweet16/sweet16.zmk.yml new file mode 100644 index 00000000..81d1cbb1 --- /dev/null +++ b/app/boards/shields/sweet16/sweet16.zmk.yml @@ -0,0 +1,9 @@ +file_format: "1" +id: sweet16 +name: Sweet 16 +type: shield +url: https://1upkeyboards.com/shop/keyboard-kits/macro-pads/sweet16-macro-pad-white/ +requires: [pro_micro] +features: + - keys + - underglow