refactor(shield): tidbit

* Implement alternative matrix-transform.

* Add missing wakeup-source attribute.

* Revise README to provide more appropriate information.

* Remove unnecessary files (partially-functional shield).
This commit is contained in:
honorless 2024-07-07 21:37:52 -04:00
parent b42d06ecf7
commit d1ac22c29c
No known key found for this signature in database
GPG key ID: 1B48A311ABE8DA4D
10 changed files with 166 additions and 238 deletions

View file

@ -1,41 +1,6 @@
# Building ZMK for the Tidbit
# TIDBIT Compatibility Notes
Some general notes/commands for building standard tidbit layouts from the assembly documentation.
## Standard "Non Dense" Build
```
west build -p -d build/tidbit/default --board nice_nano -- -DSHIELD=tidbit
```
## Dense "19 keys" Build
```
west build -p -d build/tidbit/19_key --board nice_nano -- -DSHIELD=tidbit_19key
```
## LED Notes
If you built your tidbit without the LEDs _and_ are using a nice!nano board, you'll need to change the following in your local tidbit config or add them to the end of the file.
```
CONFIG_ZMK_RGB_UNDERGLOW=n
CONFIG_WS2812_STRIP=n
```
## Encoder Notes
If you built your tidbit without encoders, you'll need to change the following in your local tidbit config or add them to the end of the file.
```
CONFIG_EC11=n
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=n
```
## OLED Builds
If using an OLED screen, you'll need to change the following in your local tidbit config or add them to the end of the file.
```
CONFIG_ZMK_DISPLAY=y
```
- The top-left and top-right encoders share the same pins. Install only one, and enable/include EITHER `encoder_1` OR `encoder_1_top_row` in your keymap; not both.
- `encoder_3` cannot be used at the same time as the OLED and/or HT16K33 modules, as it is wired to the same pins.
- While the HT16K33 hardware is supported by Zephyr, functionality may not have been implemented in ZMK for it.
- `encoder_4` cannot be used at the same time as the TRRS jack, as it is wired to the same pins.

View file

@ -1,4 +0,0 @@
# Enable underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y

View file

@ -5,7 +5,11 @@
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
# Enable underglow
# Uncomment to enable underglow
#CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
#CONFIG_WS2812_STRIP=y
# Uncomment to enable the display
# Note that an I2C OLED cannot be used at the same time as encoder 3.
#CONFIG_ZMK_DISPLAY=y

View file

@ -1,111 +0,0 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "row2col";
row-gpios
= <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-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)>
;
};
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";
a-gpios = <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_3: encoder_3 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_4: encoder_4 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};
};
&pro_micro_i2c {
status = "okay";
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -6,20 +6,40 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/outputs.h>
&encoder_1_top_row {
/* Enable ONLY ONE of the &encoder_1 nodes. They are wired to the same pins.*/
/*
&encoder_1 {
status = "okay";
};
&encoder_1_top_left {
status = "okay";
};
*/
/*
&encoder_2 {
status = "okay";
};
/ {
sensors: sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1_top_row>;
triggers-per-rotation = <20>;
&encoder_3 {
status = "okay";
};
*/
&encoder_4 {
status = "okay";
};
/* Add any encoder(s) you have enabled to the sensors node, separated by spaces. */
&sensors {
sensors = <&encoder_4>;
};
/ {
keymap {
compatible = "zmk,keymap";
@ -27,9 +47,9 @@
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 &none
&kp KP_NUMBER_4 &kp KP_NUMBER_5 &kp KP_NUMBER_6 &kp KP_SLASH
&kp KP_NUMBER_1 &kp KP_NUMBER_2 &kp KP_NUMBER_3 &lt 1 KP_ENTER
&none &kp KP_NUMBER_0 &kp KP_DOT &none
&kp C_MUTE &kp KP_NUMBER_0 &kp KP_DOT &kp KP_ENTER
>;
sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
@ -40,7 +60,7 @@
&none &sys_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
&bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &trans
&kp C_MUTE &none &none &none
>;

View file

@ -4,4 +4,127 @@
* SPDX-License-Identifier: MIT
*/
#include "tidbit.dtsi"
#include <dt-bindings/zmk/matrix_transform.h>
/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "row2col";
wakeup-source;
row-gpios
= <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-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)>
;
};
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)
>;
};
numpad_transform: keymap_transform_1 {
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(3,0) RC(3,1) RC(3,2) RC(3,3)
RC(4,0) RC(4,1) RC(4,2)
>;
};
encoder_1_top_row: encoder_1_top_row {
compatible = "alps,ec11";
a-gpios = <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 14 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 16 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_2: encoder_2 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_3: encoder_3 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 2 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
encoder_4: encoder_4 {
compatible = "alps,ec11";
a-gpios = <&pro_micro 1 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 0 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
steps = <80>;
status = "disabled";
};
sensors: sensors {
compatible = "zmk,keymap-sensors";
triggers-per-rotation = <20>;
};
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix-transform = &default_transform;
};
};
&pro_micro_i2c {
status = "okay";
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
segment-remap;
com-invdir;
com-sequential;
inversion-on;
prechargep = <0x22>;
};
};

View file

@ -1,11 +0,0 @@
# 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

View file

@ -1,50 +0,0 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "tidbit.dtsi"
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
&encoder_4 {
status = "okay";
};
/ {
sensors: 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 &sys_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>;
};
};
};

View file

@ -1,8 +0,0 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "tidbit.dtsi"
#include "tidbit_19key.keymap"