Browse Source

Add support for Knob Goblin shield

xmkb
Lucas Uyezu 3 years ago committed by Nick Winans
parent
commit
4a1254bc27
  1. 45
      app/boards/shields/knob_goblin/Kconfig.defconfig
  2. 5
      app/boards/shields/knob_goblin/Kconfig.shield
  3. 9
      app/boards/shields/knob_goblin/knob_goblin.conf
  4. 40
      app/boards/shields/knob_goblin/knob_goblin.keymap
  5. 79
      app/boards/shields/knob_goblin/knob_goblin.overlay
  6. 11
      app/boards/shields/knob_goblin/knob_goblin.zmk.yml

45
app/boards/shields/knob_goblin/Kconfig.defconfig

@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if SHIELD_KNOB_GOBLIN
config ZMK_KEYBOARD_NAME
default "Knob Goblin"
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_MAX
default 128
config LVGL_VER_RES_MAX
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
endif # SHIELD_KNOB_GOBLIN

5
app/boards/shields/knob_goblin/Kconfig.shield

@ -0,0 +1,5 @@ @@ -0,0 +1,5 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_KNOB_GOBLIN
def_bool $(shields_list_contains,knob_goblin)

9
app/boards/shields/knob_goblin/knob_goblin.conf

@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Uncomment to enable Encoders
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
# Uncomment the following line to enable the Knob Goblin OLED Display
CONFIG_ZMK_DISPLAY=y

40
app/boards/shields/knob_goblin/knob_goblin.keymap

@ -0,0 +1,40 @@ @@ -0,0 +1,40 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&trans &kp EQUAL &kp KP_SLASH &kp KP_MULTIPLY &kp KP_MINUS
&trans &kp KP_NUMBER_7 &kp KP_NUMBER_8 &kp KP_NUMBER_9 &kp KP_PLUS
&trans &kp KP_NUMBER_4 &kp KP_NUMBER_5 &kp KP_NUMBER_6 &kp KP_PLUS
&kp C_PLAY_PAUSE &kp KP_NUMBER_1 &kp KP_NUMBER_2 &kp KP_NUMBER_3 &kp KP_ENTER
&kp C_MUTE &mo 1 &kp KP_NUMBER_0 &kp KP_DOT &kp KP_ENTER
>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>;
};
num_layer {
bindings = <
&trans &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2
&trans &kp HOME &trans &kp PAGE_UP &trans
&trans &kp END &kp UP_ARROW &kp PAGE_DOWN &trans
&trans &kp LEFT_ARROW &kp DOWN_ARROW &kp RIGHT_ARROW &kp SPACE
&trans &trans &kp BACKSPACE &kp DELETE &trans
>;
};
};
};

79
app/boards/shields/knob_goblin/knob_goblin.overlay

@ -0,0 +1,79 @@ @@ -0,0 +1,79 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <dt-bindings/zmk/matrix_transform.h>
/ {
chosen {
zmk,kscan = &kscan0;
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
row-gpios
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
col-gpios
= <&pro_micro 9 GPIO_ACTIVE_HIGH>
, <&pro_micro 8 GPIO_ACTIVE_HIGH>
, <&pro_micro 7 GPIO_ACTIVE_HIGH>
, <&pro_micro 6 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
;
};
top_encoder: encoder_top {
compatible = "alps,ec11";
label = "TOP_ENCODER";
a-gpios = <&pro_micro 19 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 18 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
bottom_encoder: encoder_bottom {
compatible = "alps,ec11";
label = "BOTTOM_ENCODER";
a-gpios = <&pro_micro 20 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro 21 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&top_encoder &bottom_encoder>;
};
};
&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>;
};
};

11
app/boards/shields/knob_goblin/knob_goblin.zmk.yml

@ -0,0 +1,11 @@ @@ -0,0 +1,11 @@
file_format: "1"
id: knob_goblin
name: Knob Goblin
type: shield
url: https://knob-goblin.com/
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
- encoder
Loading…
Cancel
Save