Base code for the DEFCON Cafe Babe keyboard
This commit is contained in:
parent
08687b1709
commit
c56090e1be
7 changed files with 328 additions and 0 deletions
42
app/boards/shields/cafeBabe/Kconfig.defconfig
Normal file
42
app/boards/shields/cafeBabe/Kconfig.defconfig
Normal file
|
@ -0,0 +1,42 @@
|
|||
if SHIELD_CAFEBABE
|
||||
|
||||
config ZMK_KEYBOARD_NAME
|
||||
default "cafeBabe"
|
||||
|
||||
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_MAX
|
||||
default 128
|
||||
|
||||
config LVGL_VER_RES_MAX
|
||||
default 64
|
||||
|
||||
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
|
5
app/boards/shields/cafeBabe/Kconfig.shield
Normal file
5
app/boards/shields/cafeBabe/Kconfig.shield
Normal file
|
@ -0,0 +1,5 @@
|
|||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
||||
config SHIELD_CAFEBABE
|
||||
def_bool $(shields_list_contains,cafeBabe)
|
34
app/boards/shields/cafeBabe/boards/nrfmicro_13.overlay
Normal file
34
app/boards/shields/cafeBabe/boards/nrfmicro_13.overlay
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
&spi1 {
|
||||
compatible = "nordic,nrf-spim";
|
||||
status = "okay";
|
||||
mosi-pin = <41>; //1.09
|
||||
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
|
||||
sck-pin = <5>; // 0.05 is not broken out on the nRFMicro
|
||||
miso-pin = <7>; // 0.07 is not broken out on the nRFMicro
|
||||
|
||||
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 = <25>; /* arbitrary; change at will */
|
||||
spi-one-frame = <0x70>;
|
||||
spi-zero-frame = <0x40>;
|
||||
};
|
||||
};
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,underglow = &led_strip;
|
||||
};
|
||||
};
|
14
app/boards/shields/cafeBabe/cafeBabe.conf
Normal file
14
app/boards/shields/cafeBabe/cafeBabe.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
# Turn on logging, and set ZMK logging to debug output
|
||||
CONFIG_ZMK_USB_LOGGING=y
|
||||
# Uncomment to enable encoder
|
||||
CONFIG_EC11=y
|
||||
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
|
||||
CONFIG_ZMK_RGB_UNDERGLOW=y
|
||||
# Use the STRIP config specific to the LEDs you're using
|
||||
CONFIG_WS2812_STRIP=y
|
||||
CONFIG_ZMK_RGB_UNDERGLOW_ON_START=y
|
||||
# Uncomment the following line to enable the Kyria OLED Display
|
||||
CONFIG_ZMK_DISPLAY=y
|
||||
# Cristal config
|
||||
CONFIG_CLOCK_CONTROL_NRF=y
|
||||
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y
|
78
app/boards/shields/cafeBabe/cafeBabe.keymap
Normal file
78
app/boards/shields/cafeBabe/cafeBabe.keymap
Normal file
|
@ -0,0 +1,78 @@
|
|||
/*
|
||||
* 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>
|
||||
#include <dt-bindings/zmk/rgb.h>
|
||||
#include <dt-bindings/zmk/outputs.h>
|
||||
|
||||
#define DEF 0
|
||||
#define CONF 1
|
||||
#define RGB 2
|
||||
#define BT 3
|
||||
|
||||
#define NONE 0
|
||||
|
||||
/ {
|
||||
keymap {
|
||||
compatible = "zmk,keymap";
|
||||
|
||||
default_layer {
|
||||
bindings = <
|
||||
&kp G
|
||||
&kp H
|
||||
&kp A &kp TAB &kp DEL
|
||||
&kp B &kp KP_SLASH &kp KP_ASTERISK
|
||||
&kp C &kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_MINUS
|
||||
&kp D &kp KP_N4 &kp KP_N5 &kp KP_N6 &kp KP_PLUS
|
||||
&kp E &kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER
|
||||
< CONF F &kp COLON &kp KP_N0 &kp KP_DOT
|
||||
>;
|
||||
|
||||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
|
||||
};
|
||||
|
||||
config_layer {
|
||||
bindings = <
|
||||
&trans
|
||||
&trans
|
||||
&trans &trans &trans
|
||||
&trans &trans &trans
|
||||
&to RGB &kp HOME &kp UP &kp PG_UP &trans
|
||||
&to BT &kp LEFT &kp DOWN &kp RIGHT &trans
|
||||
&rgb_ug RGB_TOG &kp END &kp DOWN &kp PG_DN &trans
|
||||
&none &trans &kp C_AL_CALC &trans
|
||||
>;
|
||||
};
|
||||
|
||||
rgb_layer {
|
||||
bindings = <
|
||||
&trans
|
||||
&trans
|
||||
&trans &trans &trans
|
||||
&trans &trans &trans
|
||||
&rgb_ug RGB_BRI &rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_SPI &trans
|
||||
&rgb_ug RGB_BRD &rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_SPD &trans
|
||||
&rgb_ug RGB_TOG &rgb_ug RGB_EFR &rgb_ug RGB_EFF &trans &trans
|
||||
&to DEF &rgb_ug RGB_COLOR_HSB(128,100,100) &trans &trans
|
||||
>;
|
||||
};
|
||||
|
||||
bt_layer {
|
||||
bindings = <
|
||||
&trans
|
||||
&trans
|
||||
&trans &trans &trans
|
||||
&trans &trans &trans
|
||||
&out OUT_TOG &trans &trans &trans &trans
|
||||
&bt BT_SEL 0 &trans &trans &trans &trans
|
||||
&bt BT_CLR &trans &trans &trans &trans
|
||||
&to DEF &trans &trans &trans
|
||||
>;
|
||||
};
|
||||
};
|
||||
};
|
89
app/boards/shields/cafeBabe/cafeBabe.overlay
Normal file
89
app/boards/shields/cafeBabe/cafeBabe.overlay
Normal file
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
= <&gpio0 13 GPIO_ACTIVE_HIGH> // 0
|
||||
, <&gpio1 2 GPIO_ACTIVE_HIGH> // 1
|
||||
, <&gpio0 30 GPIO_ACTIVE_HIGH> // 2
|
||||
, <&gpio0 31 GPIO_ACTIVE_HIGH> // 3
|
||||
, <&gpio0 29 GPIO_ACTIVE_HIGH> // 4
|
||||
, <&gpio0 2 GPIO_ACTIVE_HIGH> // 5
|
||||
, <&gpio1 13 GPIO_ACTIVE_HIGH> // 6
|
||||
;
|
||||
|
||||
row-gpios
|
||||
= <&gpio0 24 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 0
|
||||
, <&gpio0 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 1
|
||||
, <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 2
|
||||
, <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 3
|
||||
, <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 4
|
||||
, <&gpio1 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 5
|
||||
, <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 6
|
||||
, <&gpio0 28 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // 7
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <7>;
|
||||
rows = <8>;
|
||||
|
||||
map = <
|
||||
RC(0,0)
|
||||
RC(1,1)
|
||||
RC(2,2) RC(2,5) RC(2,6)
|
||||
RC(3,2) RC(3,5) RC(3,6)
|
||||
RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6)
|
||||
RC(5,2) RC(5,3) RC(5,4) RC(5,5) RC(5,6)
|
||||
RC(6,2) RC(6,3) RC(6,4) RC(6,5) RC(6,6)
|
||||
RC(7,2) RC(7,3) RC(7,4) RC(7,5)
|
||||
>;
|
||||
};
|
||||
|
||||
left_encoder: encoder_left {
|
||||
compatible = "alps,ec11";
|
||||
label = "LEFT_ENCODER";
|
||||
a-gpios = <&gpio0 22 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
b-gpios = <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
resolution = <4>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
sensors {
|
||||
compatible = "zmk,keymap-sensors";
|
||||
sensors = <&left_encoder>;
|
||||
};
|
||||
};
|
||||
|
||||
&pro_micro_i2c {
|
||||
status = "okay";
|
||||
|
||||
ssd1306@3c {
|
||||
compatible = "solomon,ssd1306fb";
|
||||
reg = <0x3c>;
|
||||
label = "DISPLAY";
|
||||
width = <128>;
|
||||
height = <64>;
|
||||
segment-offset = <0>;
|
||||
page-offset = <0>;
|
||||
display-offset = <0>;
|
||||
multiplex-ratio = <63>;
|
||||
prechargep = <0x22>;
|
||||
};
|
||||
};
|
66
app/boards/shields/cafeBabe/cafeBabe.overlay.working
Normal file
66
app/boards/shields/cafeBabe/cafeBabe.overlay.working
Normal file
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <dt-bindings/zmk/matrix_transform.h>
|
||||
|
||||
/ {
|
||||
chosen {
|
||||
zmk,kscan = &kscan0;
|
||||
zmk,matrix_transform = &default_transform;
|
||||
};
|
||||
|
||||
kscan0: kscan_0 {
|
||||
compatible = "zmk,kscan-gpio-matrix";
|
||||
label = "KSCAN";
|
||||
diode-direction = "col2row";
|
||||
|
||||
col-gpios
|
||||
= <&gpio0 30 GPIO_ACTIVE_HIGH>
|
||||
, <&gpio0 31 GPIO_ACTIVE_HIGH>
|
||||
, <&gpio0 29 GPIO_ACTIVE_HIGH>
|
||||
, <&gpio0 2 GPIO_ACTIVE_HIGH>
|
||||
, <&gpio1 13 GPIO_ACTIVE_HIGH>
|
||||
;
|
||||
|
||||
row-gpios
|
||||
= <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&gpio1 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&gpio1 11 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&gpio1 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&gpio0 3 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
, <&gpio0 28 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
|
||||
;
|
||||
};
|
||||
|
||||
default_transform: keymap_transform_0 {
|
||||
compatible = "zmk,matrix-transform";
|
||||
columns = <6>;
|
||||
rows = <5>;
|
||||
|
||||
map = <
|
||||
RC(0,0) RC(0,3) RC(0,4)
|
||||
RC(1,0) RC(1,3) RC(1,4)
|
||||
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4)
|
||||
RC(3,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4)
|
||||
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4)
|
||||
RC(5,0) RC(5,1) RC(5,2) RC(5,3)
|
||||
>;
|
||||
};
|
||||
|
||||
left_encoder: encoder_left {
|
||||
compatible = "alps,ec11";
|
||||
label = "LEFT_ENCODER";
|
||||
a-gpios = <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
b-gpios = <&gpio1 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
|
||||
resolution = <4>;
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
sensors {
|
||||
compatible = "zmk,keymap-sensors";
|
||||
sensors = <&left_encoder>;
|
||||
};
|
||||
};
|
Loading…
Add table
Reference in a new issue