Skip to content

Commit

Permalink
refactor(shield): tidbit
Browse files Browse the repository at this point in the history
* Implement alternative matrix-transform.

* Add missing wakeup-source attribute.

* Revise README to provide more appropriate information.

* Remove unnecessary files (partially-functional shield).
  • Loading branch information
lesshonor authored and petejohanson committed Sep 6, 2024
1 parent 2a137bb commit a2f32cc
Show file tree
Hide file tree
Showing 10 changed files with 166 additions and 238 deletions.
45 changes: 5 additions & 40 deletions app/boards/shields/tidbit/README.md
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 0 additions & 4 deletions app/boards/shields/tidbit/boards/nice_nano.conf

This file was deleted.

Empty file.
6 changes: 5 additions & 1 deletion app/boards/shields/tidbit/tidbit.conf
Original file line number Diff line number Diff line change
Expand Up @@ -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
111 changes: 0 additions & 111 deletions app/boards/shields/tidbit/tidbit.dtsi

This file was deleted.

44 changes: 32 additions & 12 deletions app/boards/shields/tidbit/tidbit.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,61 @@

#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";
};
*/

/ {
sensors: sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1_top_row>;
triggers-per-rotation = <20>;
};
/*
&encoder_2 {
status = "okay";
};

&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";

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 &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>;
};

func_layer {
bindings = <
&none &sys_reset &bootloader
&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
>;

Expand Down
125 changes: 124 additions & 1 deletion app/boards/shields/tidbit/tidbit.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
};
};
11 changes: 0 additions & 11 deletions app/boards/shields/tidbit/tidbit_19key.conf

This file was deleted.

Loading

0 comments on commit a2f32cc

Please sign in to comment.