Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(shields): Add Fifi Shield Support #1008

Closed
wants to merge 11 commits into from
55 changes: 55 additions & 0 deletions app/boards/shields/fifi/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_FIFI_LEFT
hmngwy marked this conversation as resolved.
Show resolved Hide resolved

config ZMK_KEYBOARD_NAME
default "Fifi"

config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y

endif

if SHIELD_FIFI_LEFT || SHIELD_FIFI_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 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
8 changes: 8 additions & 0 deletions app/boards/shields/fifi/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

config SHIELD_FIFI_LEFT
def_bool $(shields_list_contains,fifi_left)

config SHIELD_FIFI_RIGHT
def_bool $(shields_list_contains,fifi_right)
29 changes: 29 additions & 0 deletions app/boards/shields/fifi/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 = <6>; /* There are per-key RGB, but the first 6 are underglow */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
6 changes: 6 additions & 0 deletions app/boards/shields/fifi/fifi.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Uncomment the following lines to enable the Fifi RGB Underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y

# Uncomment the following line to enable the Fifi OLED Display
# CONFIG_ZMK_DISPLAY=y
65 changes: 65 additions & 0 deletions app/boards/shields/fifi/fifi.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

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

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

default_transform: keymap_transform_0 {
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 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>;
};
};
72 changes: 72 additions & 0 deletions app/boards/shields/fifi/fifi.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/*
* 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 {
// -----------------------------------------------------------------------------------------
// | Q | W | E | R | T | | Y | U | I | O | P |
// | A | S | D | F | G | | H | J | K | L | ; |
// | Z | X | C | V | B | | N | M | , | . | / |
// | GUI | NAV | SHFT | | SPC | SYM | ALT |
bindings = <
&kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P
&kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH
&kp LGUI &mo 1 &kp LSHFT &kp SPACE &mo 2 &kp RALT
>;
};
nav_layer {
// -----------------------------------------------------------------------------------------
// |BTCLR| | ESC | ~ | | | TAB | HOME | UP | END | DEL |
// | BT1 | GUI | ALT | CTRL | NUM | | / | LEFT | DOWN | RGT | BKSP |
// | BT2 | | | | | | \ | ENT | | | |
// | | | | | | | |
bindings = <
&bt BT_CLR &trans &kp ESC &kp TILDE &trans &kp TAB &kp HOME &kp UP &kp END &kp DEL
&bt BT_SEL 0 &kp K_CMENU &kp RALT &kp LCTRL &mo 3 &kp FSLH &kp LEFT &kp DOWN &kp RIGHT &kp BSPC
&bt BT_SEL 1 &trans &trans &trans &trans &kp BSLH &kp RET &trans &trans &trans
&trans &trans &trans &trans &trans &trans
>;
};

sym_layer {
// -----------------------------------------------------------------------------------------
// | ! | @ | # | $ | % | | ^ | & | * | ( | ) |
// | | | | | | | - | = | { | } | "|" |
// | | | | | | | _ | + | [ | ] | \ |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR
&trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp PIPE
&trans &trans &trans &trans &trans &trans &trans &trans &trans &kp BSLH
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};

// This layer is unreachable until "tri layer state" is sorted out.
// Leaving it here for completeness.
num_layer {
// -----------------------------------------------------------------------------------------
// | | | | | | | A | 7 | 8 | 9 | D |
// | | | | | | | B | 4 | 5 | 6 | E |
// | | | | | | | C | 1 | 2 | 3 | F |
// | | | | | 0 | . | |
bindings = <
&trans &trans &trans &trans &trans &kp A &kp N7 &kp N8 &kp N9 &kp D
&trans &trans &trans &trans &trans &kp B &kp N4 &kp N5 &kp N6 &kp E
&trans &trans &trans &trans &trans &kp C &kp N1 &kp N2 &kp N3 &kp F
&trans &trans &trans &kp N0 &kp DOT &trans
>;
};
};
};
14 changes: 14 additions & 0 deletions app/boards/shields/fifi/fifi.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
file_format: "1"
id: fifi
name: Fifi
type: shield
url: https://github.com/raychengy/fifi_split_keeb
requires: [pro_micro]
exposes: [i2c_oled]
features:
- keys
- display
- underglow
siblings:
- fifi_left
- fifi_right
Empty file.
18 changes: 18 additions & 0 deletions app/boards/shields/fifi/fifi_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "fifi.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>
;
};
Empty file.
22 changes: 22 additions & 0 deletions app/boards/shields/fifi/fifi_right.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "fifi.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>
;
};