Skip to content

Commit

Permalink
Initial shield
Browse files Browse the repository at this point in the history
  • Loading branch information
280Zo committed Jul 28, 2024
1 parent 9cb5d14 commit 20375cf
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 16 deletions.
4 changes: 2 additions & 2 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@
---
include:
- board: nice_nano_v2
shield: kyria_rev3_left
shield: charybdis_left
- board: nice_nano_v2
shield: kyria_rev3_right
shield: charybdis_right
16 changes: 16 additions & 0 deletions config/boards/shields/charybdis-mini-wireless/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
if SHIELD_CHARYBDIS_RIGHT

config ZMK_KEYBOARD_NAME
default "Charybdis"

config ZMK_SPLIT_BLE_ROLE_CENTRAL
default y

endif

if SHIELD_CHARYBDIS_LEFT || SHIELD_CHARYBDIS_RIGHT

config ZMK_SPLIT
default y

endif
5 changes: 5 additions & 0 deletions config/boards/shields/charybdis-mini-wireless/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
config SHIELD_CHARYBDIS_LEFT
def_bool $(shields_list_contains,charybdis_left)

config SHIELD_CHARYBDIS_RIGHT
def_bool $(shields_list_contains,charybdis_right)
File renamed without changes.
37 changes: 37 additions & 0 deletions config/boards/shields/charybdis-mini-wireless/charybdis.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#include <dt-bindings/zmk/matrix_transform.h>

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

vbatt: vbatt {
compatible = "zmk,battery-nrf-vddh";
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;

map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,11) RC(0,10) RC(0,9) RC(0,8) RC(0,7) RC(0,6)
RC(1,0) RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,11) RC(1,10) RC(1,9) RC(1,8) RC(1,7) RC(1,6)
RC(2,0) RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,11) RC(2,10) RC(2,9) RC(2,8) RC(2,7) RC(2,6)
RC(3,3) RC(3,4) RC(3,1) RC(3,7) RC(3,9)
>;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
wakeup-source;
diode-direction = "row2col";
row-gpios
= <&pro_micro 18 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
, <&pro_micro 4 GPIO_ACTIVE_HIGH>
, <&pro_micro 9 GPIO_ACTIVE_HIGH>
;
};
};
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include "charybdis.dtsi"

&kscan0 {
col-gpios
= <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 10 (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 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
23 changes: 23 additions & 0 deletions config/boards/shields/charybdis-mini-wireless/charybdis_right.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# https://github.com/inorichi/zmk-pmw3610-driver?tab=readme-ov-file
CONFIG_SPI=y
CONFIG_INPUT=y
CONFIG_ZMK_MOUSE=y
CONFIG_PMW3610=y

# https://zmk.dev/docs/config/power#kconfig-2
CONFIG_ZMK_EXT_POWER=y

# https://github.com/inorichi/zmk-pmw3610-driver/blob/main/Kconfig
CONFIG_PMW3610_SMART_ALGORITHM=y
CONFIG_PMW3610_CPI=1200
CONFIG_PMW3610_CPI_DIVIDOR=4
CONFIG_PMW3610_SNIPE_CPI=800
CONFIG_PMW3610_SNIPE_CPI_DIVIDOR=4
CONFIG_PMW3610_SCROLL_TICK=20
CONFIG_PMW3610_RUN_DOWNSHIFT_TIME_MS=3264
CONFIG_PMW3610_REST1_SAMPLE_TIME_MS=20
CONFIG_PMW3610_POLLING_RATE_125_SW=y
CONFIG_PMW3610_ORIENTATION_90=y
CONFIG_PMW3610_INVERT_X=y
CONFIG_PMW3610_INVERT_SCROLL_Y=n
CONFIG_PMW3610_AUTOMOUSE_TIMEOUT_MS=400
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#include "charybdis.dtsi"

// The matrix transform is 6 columns over because the left half is 6 columns wide.
&default_transform {
col-offset = <6>;
};

&kscan0 {
col-gpios
= <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 10 (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 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

// https://github.com/inorichi/zmk-pmw3610-driver
&pinctrl {
spi0_default: spi0_default {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
<NRF_PSEL(SPIM_MISO, 0, 17)>;
};
};

spi0_sleep: spi0_sleep {
group1 {
psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
<NRF_PSEL(SPIM_MOSI, 0, 17)>,
<NRF_PSEL(SPIM_MISO, 0, 17)>;
low-power-enable;
};
};
};

&spi0 {
status = "okay";
compatible = "nordic,nrf-spim";
pinctrl-0 = <&spi0_default>;
pinctrl-1 = <&spi0_sleep>;
pinctrl-names = "default", "sleep";
cs-gpios = <&gpio0 20 GPIO_ACTIVE_LOW>;

trackball: trackball@0 {
status = "okay";
compatible = "pixart,pmw3610";
reg = <0>;
spi-max-frequency = <2000000>;
irq-gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
/* optional features */
// snipe-layers = <1>;
scroll-layers = <2 3>;
automouse-layer = <4>;
};
};

/ {
trackball_listener {
compatible = "zmk,input-listener";
device = <&trackball>;

};
};
13 changes: 13 additions & 0 deletions config/boards/shields/charybdis-mini-wireless/charybdis_zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
file_format: "1"
id: charybdis
name: Charybdis
type: shield
url: https://github.com/Bastardkb/Charybdis/
requires: [pro_micro]
features:
- keys
- pointer
- colemak DH
siblings:
- charybdis_left
- charybdis_right
13 changes: 13 additions & 0 deletions config/charybdis.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
CONFIG_ZMK_SLEEP=y
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
CONFIG_ZMK_MOUSE=y

CONFIG_BT_PERIPHERAL_PREF_MAX_INT=9
CONFIG_BT_PERIPHERAL_PREF_LATENCY=16
CONFIG_BT_BUF_ACL_TX_COUNT=32
CONFIG_BT_L2CAP_TX_BUF_COUNT=32

CONFIG_ZMK_BLE_EXPERIMENTAL_CONN=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_FETCHING=y
CONFIG_ZMK_SPLIT_BLE_CENTRAL_BATTERY_LEVEL_PROXY=y
CONFIG_ZMK_BEHAVIORS_QUEUE_SIZE=512
55 changes: 55 additions & 0 deletions config/charybdis.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
{
"id": "charybdis",
"name": "charybdis",
"layouts": {
"default": {
"layout": [
{ "label": "", "row": 0, "col": 0, "x": 0, "y": 0.360 },
{ "label": "", "row": 0, "col": 1, "x": 1, "y": 0.360 },
{ "label": "", "row": 0, "col": 2, "x": 2, "y": 0.110 },
{ "label": "", "row": 0, "col": 3, "x": 3, "y": -0.015 },
{ "label": "", "row": 0, "col": 4, "x": 4, "y": 0.110 },
{ "label": "", "row": 0, "col": 5, "x": 5, "y": 0.110 },
{ "label": "", "row": 0, "col": 7, "x": 9, "y": 0.110 },
{ "label": "", "row": 0, "col": 8, "x": 10, "y": 0.110 },
{ "label": "", "row": 0, "col": 9, "x": 11, "y": -0.015 },
{ "label": "", "row": 0, "col": 10, "x": 12, "y": 0.110 },
{ "label": "", "row": 0, "col": 11, "x": 13, "y": 0.360 },
{ "label": "", "row": 0, "col": 12, "x": 14, "y": 0.360 },

{ "label": "", "row": 1, "col": 0, "x": 0, "y": 1.360 },
{ "label": "", "row": 1, "col": 1, "x": 1, "y": 1.360 },
{ "label": "", "row": 1, "col": 2, "x": 2, "y": 1.110 },
{ "label": "", "row": 1, "col": 3, "x": 3, "y": 0.985 },
{ "label": "", "row": 1, "col": 4, "x": 4, "y": 1.110 },
{ "label": "", "row": 1, "col": 5, "x": 5, "y": 1.110 },
{ "label": "", "row": 1, "col": 7, "x": 9, "y": 1.110 },
{ "label": "", "row": 1, "col": 8, "x": 10, "y": 1.110 },
{ "label": "", "row": 1, "col": 9, "x": 11, "y": 0.985 },
{ "label": "", "row": 1, "col": 10, "x": 12, "y": 1.110 },
{ "label": "", "row": 1, "col": 11, "x": 13, "y": 1.360 },
{ "label": "", "row": 1, "col": 12, "x": 14, "y": 1.360 },

{ "label": "", "row": 2, "col": 0, "x": 0, "y": 2.360 },
{ "label": "", "row": 2, "col": 1, "x": 1, "y": 2.360 },
{ "label": "", "row": 2, "col": 2, "x": 2, "y": 2.110 },
{ "label": "", "row": 2, "col": 3, "x": 3, "y": 1.985 },
{ "label": "", "row": 2, "col": 4, "x": 4, "y": 2.110 },
{ "label": "", "row": 2, "col": 5, "x": 5, "y": 2.110 },
{ "label": "", "row": 2, "col": 7, "x": 9, "y": 2.110 },
{ "label": "", "row": 2, "col": 8, "x": 10, "y": 2.110 },
{ "label": "", "row": 2, "col": 9, "x": 11, "y": 1.985 },
{ "label": "", "row": 2, "col": 10, "x": 12, "y": 2.110 },
{ "label": "", "row": 2, "col": 11, "x": 13, "y": 2.360 },
{ "label": "", "row": 2, "col": 12, "x": 14, "y": 2.360 },

{ "label": "", "row": 3, "col": 3, "x": 3.48, "y": 3.13, "r": 0 },
{ "label": "", "row": 3, "col": 4, "x": 3.48, "y": 3.13, "r": 15, "rx": 3.98, "ry": 7.88 },
{ "label": "", "row": 3, "col": 5, "x": 3.48, "y": 3.18, "r": 30, "rx": 3.98, "ry": 7.88 },
{ "label": "", "row": 3, "col": 7, "x": 10.52, "y": 3.18, "r": -30, "rx": 11.02, "ry": 7.88 },
{ "label": "", "row": 3, "col": 8, "x": 10.52, "y": 3.13, "r": -15, "rx": 11.02, "ry": 7.88 }
]
}
},
"sensors": []
}
125 changes: 125 additions & 0 deletions config/charybdis.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
#include <behaviors/mouse_keys.dtsi>
#include <behaviors.dtsi>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/mouse.h>
#include <dt-bindings/zmk/outputs.h>

#define U_TAPPING_TERM 200

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

/ {
combos {
compatible = "zmk,combos";

Delete {
bindings = <&kp DELETE>;
key-positions = <8 9>;
};

CapsWord {
bindings = <&caps_word>;
key-positions = <17 18>;
};

Layer_7 {
bindings = <&mo 7>;
key-positions = <38 39>;
};
};

macros {
VSplit: VSplit {
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings = <&kp LEFT_SHIFT &kp SEMI &kp LS(V) &kp LS(S) &kp LS(P) &kp RET>;
label = "VSPLIT";
};

HSplit: HSplit {
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings = <&kp LEFT_SHIFT &kp SEMI &kp LS(S) &kp LS(P) &kp RET>;
label = "HSPLIT";
};
};

keymap {
compatible = "zmk,keymap";

Base {
bindings = <
&kp C_AC_SEARCH &kp Q &kp W &kp F &kp P &kp B &kp J &kp L &kp U &kp Y &kp APOS &to 5
&kp TAB &mt LEFT_GUI A &mt LEFT_ALT R &mt LCTRL S &mt LEFT_SHIFT T &kp G &kp M &mt LEFT_SHIFT N &mt RCTRL E &mt RIGHT_ALT I &mt RIGHT_GUI O &kp DEL
&caps_word &kp Z &mt LA(LS(LCTRL)) X &mt LC(LA(LS(LEFT_GUI))) C &kp D &kp V &kp K &kp H &mt LA(LS(LCTRL)) COMMA &mt LC(LA(LS(LEFT_GUI))) PERIOD &kp FSLH &to 6
&mkp LCLK &lt 1 BACKSPACE &lt 2 ESCAPE &lt 4 RETURN &lt 3 SPACE
>;
};

Num {
bindings = <
&none &none &none &none &none &none &kp SLASH &mt F7 N7 &mt F8 N8 &mt F9 N9 &mt F10 MINUS &none
&none &none &none &none &kp BACKSPACE &none &kp ASTRK &mt F4 N4 &mt F5 N5 &mt F6 N6 &mt F11 PLUS &none
&none &none &none &none &none &none &kp DOT &mt F1 N1 &mt F2 N2 &mt F3 N3 &mt F12 EQUAL &none
&none &none &none &kp N0 &none
>;
};

Nav {
bindings = <
&none &none &none &none &none &none &none &kp LS(LC(H)) &kp LS(LC(J)) &kp LS(LC(K)) &kp LS(LC(L)) &none
&trans &trans &trans &trans &trans &trans &VSplit &kp LEFT_ARROW &kp DOWN &kp UP &kp RIGHT_ARROW &none
&none &none &none &none &none &none &HSplit &kp HOME &kp PG_DN &kp PG_UP &kp END &none
&none &none &trans &trans &trans
>;
};

Sym {
bindings = <
&none &kp DOLLAR &kp LEFT_BRACE &kp RIGHT_BRACE &kp AMPERSAND &kp BSLH &none &kp COLON &kp TILDE &kp FSLH &kp PIPE &none
&none &kp ASTRK &kp LEFT_PARENTHESIS &kp RIGHT_PARENTHESIS &mt LEFT_SHIFT UNDERSCORE &kp AT_SIGN &kp SEMI &mt RIGHT_SHIFT SPACE &mt LCTRL LESS_THAN &mt LS(LEFT_ALT) GREATER_THAN &mt RIGHT_META EQUAL &none
&none &kp PERCENT &kp LBKT &kp RBKT &kp CARET &kp EXCLAMATION &none &kp GRAVE &kp HASH &kp MINUS &kp PLUS &none
&trans &trans &trans &none &trans
>;
};

Mouse {
bindings = <
&none &none &msc MOVE_DOWN &mmv MOVE_UP &msc MOVE_UP &none &none &kp K_UNDO &kp K_CUT &kp K_COPY &kp K_PASTE &none
&none &mkp MB4 &mmv MOVE_LEFT &mmv MOVE_DOWN &mmv MOVE_RIGHT &mkp MB5 &none &kp RIGHT_SHIFT &kp RCTRL &kp LEFT_ALT &kp RIGHT_META &none
&none &none &msc MOVE_LEFT &none &msc MOVE_RIGHT &none &none &none &none &none &none &none
&mkp MCLK &mkp LCLK &mkp RCLK &none &none
>;
};

Game {
bindings = <
&kp N1 &kp TAB &kp Q &kp W &kp E &kp R &none &none &none &none &none &to 0
&kp N2 &kp LCTRL &kp A &kp S &kp D &kp F &none &none &none &none &none &none
&kp N3 &kp LSHFT &kp Z &kp X &kp C &kp V &none &none &none &none &none &none
&none &kp SPACE &kp LEFT_ALT &none &none
>;
};

Photos {
bindings = <
&trans &kp LA(LC(LS(Z))) &kp LA(LC(LS(E))) &kp LA(LC(LS(A))) &kp LA(LC(LS(S))) &kp LA(LC(LS(B))) &none &none &none &none &none &none
&kp LC(LA(E)) &kp LEFT &kp DOWN &kp UP &kp RIGHT &kp LCTRL &none &none &none &none &none &none
&kp LS(DELETE) &kp LA(LS(A)) &kp LA(KP_N1) &kp LA(KP_N2) &kp LA(KP_N3) &none &none &none &none &none &none &to 0
&none &none &trans &trans &trans
>;
};

Extras {
bindings = <
&kp C_SLEEP &none &none &none &none &kp C_BRIGHTNESS_MAXIMUM &bt BT_CLR &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp K_COFFEE
&kp C_POWER &none &none &none &none &kp C_BRIGHTNESS_INC &out OUT_TOG &kp C_PREVIOUS &kp C_STOP &kp C_PLAY_PAUSE &kp C_NEXT &none
&bootloader &none &none &none &none &kp C_BRIGHTNESS_DEC &kp PRINTSCREEN &kp C_VOLUME_DOWN &kp C_VOLUME_UP &kp K_MUTE &none &bootloader
&none &none &none &none &none
>;
};
};
};
Loading

0 comments on commit 20375cf

Please sign in to comment.