Add Chocofi shield

This commit is contained in:
Tommi-l 2023-04-26 10:22:53 +02:00
parent 0239f18b61
commit 5d06cd6c25
No known key found for this signature in database
10 changed files with 206 additions and 0 deletions

View file

@ -0,0 +1,46 @@
if SHIELD_CHOCOFI_LEFT
config ZMK_KEYBOARD_NAME
default "Chocofi"
config ZMK_SPLIT_ROLE_CENTRAL
default y
endif
if SHIELD_CHOCOFI_LEFT || SHIELD_CHOCOFI_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_Z_DPI
default 148
config LV_Z_BITS_PER_PIXEL
default 1
choice LV_COLOR_DEPTH
default LV_COLOR_DEPTH_1
endchoice
endif # LVGL
endif

View file

@ -0,0 +1,8 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT
config SHIELD_CHOCOFI_LEFT
def_bool $(shields_list_contains,chocofi_left)
config SHIELD_CHOCOFI_RIGHT
def_bool $(shields_list_contains,chocofi_right)

View file

@ -0,0 +1,8 @@
# Uncomment the following line to enable the Corne OLED Display
#CONFIG_ZMK_DISPLAY=y
# Uncomment on connection issues. Boosts BT power
#CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
# Turn on logging, and set ZMK logging to debug output
#CONFIG_ZMK_USB_LOGGING=y

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* 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 = <10>;
rows = <4>;
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";
diode-direction = "col2row";
row-gpios
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 5 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
};
&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>;
};
};

View file

@ -0,0 +1,32 @@
/*
* Copyright (c) 2023 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 {
/*
╭──────┬───────┬───────┬───────┬───────╮ ╭──────┬───────┬───────┬───────┬───────╮
│ Q │ W │ E │ R │ B │ │ J │ L │ U │ Y │ ; │
│ A │ R │ S │ T │ G │ │ M │ N │ E │ I │ O │
│ Z │ X │ C │ D │ V │ │ K │ H │ , │ . │ / │
╰──────┴───────╮ ALT │ SPC │ GUI │ │ SHFT │ ENT │ BSP │───────┴───────╯
╰───────┴───────┴───────╯ ╰──────┴───────┴───────╯
*/
bindings = <
&kp Q &kp W &kp F &kp P &kp B /**/ &kp J &kp L &kp U &kp Y &kp SEMI
&kp A &kp R &kp S &kp T &kp G /**/ &kp M &kp N &kp E &kp I &kp O
&kp Z &kp X &kp C &kp D &kp V /**/ &kp K &kp H &kp COMMA &kp DOT &kp FSLH
&kp LALT &kp SPC &kp LGUI /**/ &kp LSHFT &kp RET &kp BSPC
>;
};
};
};

View file

@ -0,0 +1,13 @@
file_format: "1"
id: chocofi
name: Chocofi
type: shield
url: https://github.com/pashutk/chocofi
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
siblings:
- chocofi_left
- chocofi_right

View file

@ -0,0 +1,18 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "chocofi.dtsi"
&kscan0 {
col-gpios
= <&pro_micro 21 GPIO_ACTIVE_HIGH>
, <&pro_micro 20 GPIO_ACTIVE_HIGH>
, <&pro_micro 19 GPIO_ACTIVE_HIGH>
, <&pro_micro 18 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 14 GPIO_ACTIVE_HIGH>
;
};

View file

@ -0,0 +1,22 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include "chocofi.dtsi"
&default_transform {
col-offset = <6>;
};
&kscan0 {
col-gpios
= <&pro_micro 14 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 18 GPIO_ACTIVE_HIGH>
, <&pro_micro 19 GPIO_ACTIVE_HIGH>
, <&pro_micro 20 GPIO_ACTIVE_HIGH>
, <&pro_micro 21 GPIO_ACTIVE_HIGH>
;
};