From 982126f6dcb26c78d1fd371f38c2469f0b3e0aed Mon Sep 17 00:00:00 2001 From: kemonine Date: Sat, 5 Dec 2020 18:18:43 -0500 Subject: [PATCH] Cleanup zmk-config to be more generic and include current tidbit bringup (it's in PR status presently, needed for other work on zmk) --- .../tidbit => }/zmk-config/README.md | 0 .../boards/shields/tidbit/Kconfig.defconfig | 45 +++++++ .../boards/shields/tidbit/Kconfig.shield | 5 + .../config/boards/shields/tidbit/README.md | 50 ++++++++ .../shields/tidbit/boards/nice_nano.conf | 4 + .../shields/tidbit/boards/nice_nano.overlay | 34 +++++ .../shields/tidbit/boards/proton_c.conf | 1 + .../config/boards/shields/tidbit}/tidbit.conf | 10 +- .../config/boards/shields/tidbit/tidbit.dtsi | 116 ++++++++++++++++++ .../boards/shields/tidbit/tidbit.keymap | 53 ++++++++ .../boards/shields/tidbit/tidbit.overlay | 7 ++ .../boards/shields/tidbit/tidbit_19key.conf | 11 ++ .../boards/shields/tidbit/tidbit_19key.keymap | 54 ++++++++ .../shields/tidbit/tidbit_19key.overlay | 8 ++ keyboards/zmk-config/config/tidbit.conf | 50 ++++++++ .../zmk-config/config/tidbit.keymap | 4 + .../tidbit => }/zmk-config/config/west.yml | 0 17 files changed, 444 insertions(+), 8 deletions(-) rename keyboards/{nullbitsco/tidbit => }/zmk-config/README.md (100%) create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.defconfig create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.shield create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/README.md create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.conf create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.overlay create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/boards/proton_c.conf rename keyboards/{nullbitsco/tidbit/zmk-config/config => zmk-config/config/boards/shields/tidbit}/tidbit.conf (63%) create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit.dtsi create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit.keymap create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit.overlay create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.conf create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.keymap create mode 100644 keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.overlay create mode 100644 keyboards/zmk-config/config/tidbit.conf rename keyboards/{nullbitsco/tidbit => }/zmk-config/config/tidbit.keymap (97%) rename keyboards/{nullbitsco/tidbit => }/zmk-config/config/west.yml (100%) diff --git a/keyboards/nullbitsco/tidbit/zmk-config/README.md b/keyboards/zmk-config/README.md similarity index 100% rename from keyboards/nullbitsco/tidbit/zmk-config/README.md rename to keyboards/zmk-config/README.md diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.defconfig b/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.defconfig new file mode 100644 index 00000000..6ecb3e79 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.defconfig @@ -0,0 +1,45 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +if SHIELD_TIDBIT + +config ZMK_KEYBOARD_NAME + default "tidbit" + +endif + +if ZMK_DISPLAY + +config I2C + default y + +config SSD1306 + default y + +config SSD1306_REVERSE_MODE + default y + +endif # ZMK_DISPLAY + +if LVGL + +config LVGL_HOR_RES + default 128 + +config LVGL_VER_RES + default 32 + +config LVGL_VDB_SIZE + default 64 + +config LVGL_DPI + default 148 + +config LVGL_BITS_PER_PIXEL + default 1 + +choice LVGL_COLOR_DEPTH + default LVGL_COLOR_DEPTH_1 +endchoice + +endif # LVGL diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.shield b/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.shield new file mode 100644 index 00000000..c1e8ecca --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/Kconfig.shield @@ -0,0 +1,5 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +config SHIELD_TIDBIT + def_bool $(shields_list_contains,tidbit) diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/README.md b/keyboards/zmk-config/config/boards/shields/tidbit/README.md new file mode 100644 index 00000000..5e7b5ee8 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/README.md @@ -0,0 +1,50 @@ +# Building ZMK for the Tidbit + +Some general notes/commands for building standard Tidbit layouts from the assembly documentation. + +## Standard "Non Dense" Build + +``` + +west build -p --board nice_nano -d build/tidbit/default -- -DSHIELD=tidbit + +``` + +## Dense "19 keys" Build + +``` + +west build -p --board nice_nano -d build/tidbit/19_key -- -DSHIELD=tidbit_19key + +``` + +## LED Notes + +If you built your tidbit without the LEDs *and* are using a Nice!Nano board, you'll need to add the following at the *end* of your local tidbit config. + +``` + +CONFIG_ZMK_RGB_UNDERGLOW=n +CONFIG_WS2812_STRIP=n + +``` + +## Encoder Notes + +If you built your tidbit without encoders, you'll need to add the following at the *end* of your local tidbit config. + +``` + +CONFIG_EC11=n +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=n + +``` + +## OLED Builds + +If using an OLED screen you'll need to include the following at the *end* of your local tidbit config. + +``` +CONFIG_ZMK_DISPLAY=y + +``` diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.conf b/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.conf new file mode 100644 index 00000000..14bed3d0 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.conf @@ -0,0 +1,4 @@ +# Enable underglow +CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +CONFIG_WS2812_STRIP=y \ No newline at end of file diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.overlay b/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.overlay new file mode 100644 index 00000000..84532206 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/boards/nice_nano.overlay @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +&spi1 { + compatible = "nordic,nrf-spim"; + status = "okay"; + mosi-pin = <9>; + // 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 = <8>; /* number of LEDs */ + spi-one-frame = <0x70>; + spi-zero-frame = <0x40>; + }; +}; + +/ { + chosen { + zmk,underglow = &led_strip; + }; +}; diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/boards/proton_c.conf b/keyboards/zmk-config/config/boards/shields/tidbit/boards/proton_c.conf new file mode 100644 index 00000000..ab2b50b6 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/boards/proton_c.conf @@ -0,0 +1 @@ +CONFIG_SENSOR=y \ No newline at end of file diff --git a/keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.conf b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.conf similarity index 63% rename from keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.conf rename to keyboards/zmk-config/config/boards/shields/tidbit/tidbit.conf index d46de67e..2909a855 100644 --- a/keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.conf +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.conf @@ -6,12 +6,6 @@ CONFIG_EC11=y CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y # Enable underglow -CONFIG_ZMK_RGB_UNDERGLOW=y +#CONFIG_ZMK_RGB_UNDERGLOW=y # Use the STRIP config specific to the LEDs you're using -CONFIG_WS2812_STRIP=y - -# Display -CONFIG_ZMK_DISPLAY=y - -# Number of BT Profiles -CONFIG_BT_MAX_CONN=6 \ No newline at end of file +#CONFIG_WS2812_STRIP=y diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.dtsi b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.dtsi new file mode 100644 index 00000000..16ab3651 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.dtsi @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include + +/ { + kscan0: kscan { + compatible = "zmk,kscan-gpio-matrix"; + label = "KSCAN"; + + diode-direction = "row2col"; + + row-gpios + = <&pro_micro_d 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + col-gpios + = <&pro_micro_a 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + , <&pro_micro_a 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> + ; + + }; + + default_transform: keymap_transform_0 { + compatible = "zmk,matrix-transform"; + columns = <4>; + rows = <5>; + + map = < + RC(0,1) RC(0,2) RC(0,3) + RC(1,0) RC(1,1) RC(1,2) RC(1,3) + RC(2,0) RC(2,1) RC(2,2) RC(2,3) + RC(3,0) RC(3,1) RC(3,2) RC(3,3) + RC(4,0) RC(4,1) RC(4,2) RC(4,3) + >; + }; + + encoder_1_top_row: encoder_1_top_row { + compatible = "alps,ec11"; + label = "Top Row Encoder"; + a-gpios = <&pro_micro_d 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_d 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + encoder_1: encoder_1 { + compatible = "alps,ec11"; + label = "Encoder 1"; + a-gpios = <&pro_micro_d 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_d 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + encoder_2: encoder_2 { + compatible = "alps,ec11"; + label = "Encoder 2"; + a-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + encoder_3: encoder_3 { + compatible = "alps,ec11"; + label = "Encoder 3"; + a-gpios = <&pro_micro_d 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_d 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + encoder_4: encoder_4 { + compatible = "alps,ec11"; + label = "Encoder 4"; + a-gpios = <&pro_micro_d 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&pro_micro_d 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + chosen { + zmk,kscan = &kscan0; + zmk,matrix_transform = &default_transform; + }; +}; + +&pro_micro_i2c { + status = "disabled"; + + oled: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + reg = <0x3c>; + label = "DISPLAY"; + width = <128>; + height = <32>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <31>; + segment-remap; + com-invdir; + com-sequential; + prechargep = <0x22>; + }; +}; diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.keymap b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.keymap new file mode 100644 index 00000000..b0b2752a --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.keymap @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include +#include +#include +#include + +&encoder_1_top_row { + status = "okay"; +}; + +&pro_micro_i2c { + status = "okay"; +}; + +/ { + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&encoder_1_top_row>; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &kp KP_NUMLOCK &kp KP_ASTERISK &kp KP_MINUS + &kp KP_NUMBER_7 &kp KP_NUMBER_8 &kp KP_NUMBER_9 &kp KP_PLUS + &kp KP_NUMBER_4 &kp KP_NUMBER_5 &kp KP_NUMBER_6 &kp &none + &kp KP_NUMBER_1 &kp KP_NUMBER_2 &kp KP_NUMBER_3 < 1 KP_ENTER + &none &kp KP_NUMBER_0 &kp KP_DOT &none + >; + + sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; + }; + + func_layer { + bindings = < + &none &reset &bootloader + &out OUT_TOG &out OUT_USB &out OUT_BLE &none + &bt BT_SEL 0 &bt BT_PRV &bt BT_NXT &bt BT_CLR + &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &tog 0 + &kp C_MUTE &none &none &none + >; + + sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; + }; + }; +}; diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.overlay b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.overlay new file mode 100644 index 00000000..dc425618 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "tidbit.dtsi" diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.conf b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.conf new file mode 100644 index 00000000..2909a855 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.conf @@ -0,0 +1,11 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Enable Encoders +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Enable underglow +#CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +#CONFIG_WS2812_STRIP=y diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.keymap b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.keymap new file mode 100644 index 00000000..c5f3e4c9 --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.keymap @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "tidbit.dtsi" +#include +#include +#include +#include + +&encoder_4 { + status = "okay"; +}; + +&pro_micro_i2c { + status = "okay"; +}; + +/ { + sensors { + compatible = "zmk,keymap-sensors"; + sensors = <&encoder_4>; + }; + + keymap { + compatible = "zmk,keymap"; + + default_layer { + bindings = < + &tog 1 &kp KP_NUMLOCK &kp KP_SLASH + &kp KP_NUMBER_7 &kp KP_NUMBER_8 &kp KP_NUMBER_9 &kp KP_ASTERISK + &kp KP_NUMBER_4 &kp KP_NUMBER_5 &kp KP_NUMBER_6 &kp KP_MINUS + &kp KP_NUMBER_1 &kp KP_NUMBER_2 &kp KP_NUMBER_3 &kp KP_PLUS + &kp C_MUTE &kp KP_NUMBER_0 &kp KP_DOT &kp KP_ENTER + >; + + sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; + }; + + func_layer { + bindings = < + &tog 0 &reset &bootloader + &out OUT_TOG &out OUT_USB &out OUT_BLE &none + &bt BT_SEL 0 &bt BT_PRV &bt BT_NXT &bt BT_CLR + &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &none + &kp C_MUTE &none &none &none + >; + + sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>; + }; + }; +}; diff --git a/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.overlay b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.overlay new file mode 100644 index 00000000..dc46233e --- /dev/null +++ b/keyboards/zmk-config/config/boards/shields/tidbit/tidbit_19key.overlay @@ -0,0 +1,8 @@ +/* + * Copyright (c) 2020 The ZMK Contributors + * + * SPDX-License-Identifier: MIT + */ + +#include "tidbit.dtsi" +#include "tidbit_19key.keymap" diff --git a/keyboards/zmk-config/config/tidbit.conf b/keyboards/zmk-config/config/tidbit.conf new file mode 100644 index 00000000..2559ddcd --- /dev/null +++ b/keyboards/zmk-config/config/tidbit.conf @@ -0,0 +1,50 @@ +# Copyright (c) 2020 The ZMK Contributors +# SPDX-License-Identifier: MIT + +# Enable Encoders +#CONFIG_EC11=y +#CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y + +# Enable underglow +#CONFIG_ZMK_RGB_UNDERGLOW=y +# Use the STRIP config specific to the LEDs you're using +#CONFIG_WS2812_STRIP=y + +# Display +CONFIG_ZMK_DISPLAY=y + +# Number of BT Profiles +CONFIG_BT_MAX_CONN=6 + +################################################################################ +# Debugging +################################################################################ + +# Turn on logging, and set ZMK logging to debug output +CONFIG_LOG=y +CONFIG_ZMK_LOG_LEVEL_DBG=y + +# Turn on USB CDC ACM device +CONFIG_USB=y +CONFIG_USB_DEVICE_STACK=y +CONFIG_USB_CDC_ACM=y +CONFIG_USB_CDC_ACM_RINGBUF_SIZE=1024 +CONFIG_USB_CDC_ACM_DEVICE_NAME="CDC_ACM" +CONFIG_USB_CDC_ACM_DEVICE_COUNT=1 + +# Enable serial console +CONFIG_SERIAL=y +CONFIG_CONSOLE=y +CONFIG_UART_INTERRUPT_DRIVEN=y +CONFIG_UART_LINE_CTRL=y + +# Enable USB UART, and set the console device +CONFIG_UART_CONSOLE=y +CONFIG_USB_UART_CONSOLE=y +CONFIG_UART_CONSOLE_ON_DEV_NAME="CDC_ACM_0" +CONFIG_USB_UART_DTR_WAIT=n + +# Sensor logging +#CONFIG_SENSOR_LOG_LEVEL_DBG=y +#CONFIG_SENSOR_LOG_LEVEL=4 +#CONFIG_SENSOR_INIT_PRIORITY=90 \ No newline at end of file diff --git a/keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.keymap b/keyboards/zmk-config/config/tidbit.keymap similarity index 97% rename from keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.keymap rename to keyboards/zmk-config/config/tidbit.keymap index 5db95674..96be5be9 100644 --- a/keyboards/nullbitsco/tidbit/zmk-config/config/tidbit.keymap +++ b/keyboards/zmk-config/config/tidbit.keymap @@ -11,6 +11,10 @@ #include #include +&encoder_1_top_row { + status = "disabled"; +}; + &encoder_4 { status = "okay"; }; diff --git a/keyboards/nullbitsco/tidbit/zmk-config/config/west.yml b/keyboards/zmk-config/config/west.yml similarity index 100% rename from keyboards/nullbitsco/tidbit/zmk-config/config/west.yml rename to keyboards/zmk-config/config/west.yml