Skip to content
This repository has been archived by the owner on Aug 26, 2024. It is now read-only.

Commit

Permalink
add out-of-tree zmk definition for rollow
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbj committed Feb 1, 2024
1 parent 65386a4 commit 6b860f6
Show file tree
Hide file tree
Showing 10 changed files with 366 additions and 0 deletions.
53 changes: 53 additions & 0 deletions config/boards/shields/rollow/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
if SHIELD_ROLLOW_LEFT

config ZMK_KEYBOARD_NAME
default "Rollow"

config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y

endif

if SHIELD_ROLLOW_RIGHT

config ZMK_KEYBOARD_NAME
default "Rollow Right"

endif

if SHIELD_ROLLOW_LEFT || SHIELD_ROLLOW_RIGHT

config ZMK_SPLIT
default y

if ZMK_DISPLAY

config I2C
default y

config SSD1306
default y

config SSD1306_REVERSE_MODE
default y

endif # ZMK_DISPLAY

if LVGL

config LV_Z_VDB_SIZE
default 64

config LV_DPI_DEF
default 148

config LV_Z_BITS_PER_PIXEL
default 1

choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice

endif # LVGL

endif
8 changes: 8 additions & 0 deletions config/boards/shields/rollow/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2020 Pete Johanson
# SPDX-License-Identifier: MIT

config SHIELD_ROLLOW_LEFT
def_bool $(shields_list_contains,rollow_left)

config SHIELD_ROLLOW_RIGHT
def_bool $(shields_list_contains,rollow_right)
29 changes: 29 additions & 0 deletions config/boards/shields/rollow/boards/nice_nano.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
&spi1 {
compatible = "nordic,nrf-spim";
/* Cannot be used together with i2c0. */
status = "okay";
mosi-pin = <6>;
// 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 = "SK6812mini";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <0>; /* No RGB */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
5 changes: 5 additions & 0 deletions config/boards/shields/rollow/rollow.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Uncomment the following line to enable the OLED Display
CONFIG_ZMK_DISPLAY=y

CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
103 changes: 103 additions & 0 deletions config/boards/shields/rollow/rollow.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

#include <dt-bindings/zmk/matrix_transform.h>

/ {
chosen {
zephyr,display = &oled;
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10) RC(2,11)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

five_column_transform: keymap_transform_1 {
compatible = "zmk,matrix-transform";
columns = <10>;
rows = <4>;
// | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 |
// | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 |
// | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 |
// | SW19 | SW20 | SW21 | | SW21 | SW20 | SW19 |
map = <
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10)
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10)
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,7) RC(2,8) RC(2,9) RC(2,10)
RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8)
>;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";

diode-direction = "col2row";
row-gpios
= <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

};

left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
steps = <60>;
};

right_encoder: encoder_right {
compatible = "alps,ec11";
label = "RIGHT_ENCODER";
a-gpios = <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
steps = <60>;
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder &right_encoder>;
triggers-per-rotation = <15>;
};
};

&pro_micro_i2c {
status = "okay";

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>;
};
};
110 changes: 110 additions & 0 deletions config/boards/shields/rollow/rollow.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>

#define COL 0
#define COLL 1
#define COLR 2

/ {
behaviors {
tp: tap_mods {
compatible = "zmk,behavior-hold-tap";
label = "TAP_MODS";
#binding-cells = <2>;
tapping_term_ms = <200>;
flavor = "tap-preferred";
bindings = <&kp>, <&kp>;
};
};


keymap {
compatible = "zmk,keymap";

default_layer {
/* Default
* .-----------------------------------------. .-----------------------------------------.
* | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | SHFT | Z | X | C | V | B |-------. .-------| N | M | , | . | / | SHFT |
* '-----------------------------------------/ / \ \-----------------------------------------'
* | GUI | LWR | / Space / \ Space\ |TT(RS)| Tab |
* | | |/ / \ \ | | |
* '-------------''------' '------''-------------'
*
* Encoder Left: Up <-> Down
* Encoder Right: Left <-> Right
*/
bindings = <
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp LCTRL &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
>;

sensor-bindings = <&inc_dec_kp DOWN UP &inc_dec_kp RIGHT LEFT>;
};

lower_layer {
/* LOWER
* .-----------------------------------------. .-----------------------------------------.
* | ESC | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | SHFT | | | | | |-------. .-------| | | | | | |
* '-----------------------------------------/ / \ \-----------------------------------------'
* | GUI | | / Space / \ Enter\ | | ALT |
* | | |/ / \ \ | | |
* '-------------''------' '------''-------------'
*
* Encoder Left: PG_UP <-> PG_DN
* Encoder Right: -
*/
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;

sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp PG_UP PG_DN>;
};

raise_layer {
/* RAISE
* .-----------------------------------------. .-----------------------------------------.
* | ESC | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | CTRL | | | Prev | Next | | | - | = | { | } | "|" | ` |
* |------+------+------+------+------+------| |------+------+------+------+------+------|
* | SHFT | | | | | |-------. .-------| _ | + | [ | ] | \ | ~ |
* '-----------------------------------------/ / \ \-----------------------------------------'
* | Play | | / Space / \ Enter\ | | ALT |
* | Paus | |/ / \ \ | | |
* '------------''------' '------''-------------'
*
* Encoder Left: -
* Encoder Right: VOL_UP <-> VOL_D
*/
bindings = <
&kp ESC &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp BSPC
&kp LCTRL &trans &trans &kp C_PREV &kp C_NEXT &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp PIPE &kp GRAVE
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp BSLH &kp TILDE
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;

sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
};

};
};
3 changes: 3 additions & 0 deletions config/boards/shields/rollow/rollow_left.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_ZMK_DISPLAY=y
22 changes: 22 additions & 0 deletions config/boards/shields/rollow/rollow_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

#include "rollow.dtsi"

&kscan0 {
col-gpios
= <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
;
};

&left_encoder {
status = "okay";
};
3 changes: 3 additions & 0 deletions config/boards/shields/rollow/rollow_right.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
CONFIG_ZMK_DISPLAY=y
30 changes: 30 additions & 0 deletions config/boards/shields/rollow/rollow_right.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* Copyright (c) 2020 Pete Johanson
*
* SPDX-License-Identifier: MIT
*/

#include "rollow.dtsi"

&default_transform {
col-offset = <6>;
};

&five_column_transform {
col-offset = <6>;
};

&kscan0 {
col-gpios
= <&pro_micro_d 14 GPIO_ACTIVE_HIGH>
, <&pro_micro_d 15 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 0 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 1 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 2 GPIO_ACTIVE_HIGH>
, <&pro_micro_a 3 GPIO_ACTIVE_HIGH>
;
};

&right_encoder {
status = "okay";
};

0 comments on commit 6b860f6

Please sign in to comment.