Skip to content

Commit

Permalink
Add urchin shields
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent DELCOIGNE committed Apr 5, 2024
1 parent 2fea7c8 commit 24ec170
Show file tree
Hide file tree
Showing 11 changed files with 320 additions and 8 deletions.
17 changes: 17 additions & 0 deletions boards/shields/urchin/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2022 Duccio Breschi
# SPDX-License-Identifier: MIT

if SHIELD_URCHIN_LEFT

config ZMK_KEYBOARD_NAME
default "urchin"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif

if SHIELD_URCHIN_LEFT || SHIELD_URCHIN_RIGHT
config ZMK_SPLIT
default y
endif
8 changes: 8 additions & 0 deletions boards/shields/urchin/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2022 Duccio Breschi
# SPDX-License-Identifier: MIT

config SHIELD_URCHIN_LEFT
def_bool $(shields_list_contains,urchin_left)

config SHIELD_URCHIN_RIGHT
def_bool $(shields_list_contains,urchin_right)
33 changes: 33 additions & 0 deletions boards/shields/urchin/urchin.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright (c) 2022 Duccio Breschi
*
* 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>;

map = <
RC(0,0) 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(1,0) 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(2,0) 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(3,3) RC(3,4) RC(3,5) RC(3,6)
>;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN0";
};
};
7 changes: 7 additions & 0 deletions boards/shields/urchin/urchin.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
* Copyright (c) 2020 Duccio Breschi
*
* SPDX-License-Identifier: MIT
*/

#include "../../../urchin.keymap"
11 changes: 11 additions & 0 deletions boards/shields/urchin/urchin.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
file_format: "1"
id: urchin
name: urchin
type: shield
url: https://github.com/duckyb/urchin
requires: [pro_micro]
features:
- keys
siblings:
- urchin_left
- urchin_right
24 changes: 24 additions & 0 deletions boards/shields/urchin/urchin_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) 2022 Duccio Breschi
*
* SPDX-License-Identifier: MIT
*/

#include "urchin.dtsi"

&kscan0 {
diode-direction = "col2row";
col-gpios
= <&pro_micro 18 (GPIO_ACTIVE_HIGH)> // COL0
, <&pro_micro 15 (GPIO_ACTIVE_HIGH)> // COL1
, <&pro_micro 14 (GPIO_ACTIVE_HIGH)> // COL2
, <&pro_micro 16 (GPIO_ACTIVE_HIGH)> // COL3
, <&pro_micro 10 (GPIO_ACTIVE_HIGH)> // COL4
;
row-gpios
= <&pro_micro 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW0
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW1
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW2
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW3
;
};
28 changes: 28 additions & 0 deletions boards/shields/urchin/urchin_right.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright (c) 2022 Duccio Breschi
*
* SPDX-License-Identifier: MIT
*/

#include "urchin.dtsi"

&default_transform {
col-offset = <5>;
};

&kscan0 {
diode-direction = "col2row";
col-gpios
= <&pro_micro 5 (GPIO_ACTIVE_HIGH)> // COL0
, <&pro_micro 6 (GPIO_ACTIVE_HIGH)> // COL1
, <&pro_micro 7 (GPIO_ACTIVE_HIGH)> // COL2
, <&pro_micro 8 (GPIO_ACTIVE_HIGH)> // COL3
, <&pro_micro 9 (GPIO_ACTIVE_HIGH)> // COL4
;
row-gpios
= <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW0
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW1
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW2
, <&pro_micro 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> // ROW3
;
};
6 changes: 4 additions & 2 deletions build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
---
include:
- board: nice_nano_v2
shield: cradio_left
shield: urchin_left nice_view_adapter nice_view
- board: nice_nano_v2
shield: cradio_right
shield: urchin_right nice_view_adapter nice_view
- board: nice_nano_v2
shield: settings_reset
6 changes: 0 additions & 6 deletions config/cradio.keymap
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@
* SPDX-License-Identifier: MIT
*/

/*
* TODO:
* finish accent layer
* repenser touches F5, F9, F10, F11, F12
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
Expand Down
23 changes: 23 additions & 0 deletions config/urchin.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# increase bluetooth signal power
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

# enable deep sleep support
CONFIG_ZMK_SLEEP=y

# the keyboard disconnects from bluetooth.
# uses very little power, but it may take
# a few seconds to reconnect after waking.
# 1.800.000 ms = 30 minutes
CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=1800000

# "Eager Debouncing"
# Trying to lower the input lag.
# CONFIG_ZMK_KSCAN_DEBOUNCE_PRESS_MS=1
# CONFIG_ZMK_KSCAN_DEBOUNCE_RELEASE_MS=5

# --- DISPLAY SETTINGS ---

# disable the WPM widget
CONFIG_ZMK_WIDGET_WPM_STATUS=n
# display battery as n%
CONFIG_ZMK_WIDGET_BATTERY_STATUS_SHOW_PERCENTAGE=y
165 changes: 165 additions & 0 deletions config/urchin.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
/*
* Copyright (c) 2020 duckyb
*
* SPDX-License-Identifier: MIT
*/

#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>
#include "keymap_italian.h"

// Layer definitions
#define BASE 0
#define SYM 1
#define EXT 2
#define FNC 3
#define SYM2 4
#define ACCENT 5
#define SETTINGS 6
// -----------------

&sk {
// don't release mods on other mods presses
ignore-modifiers;
};


/ {
behaviors {
// Enables holding the first mod-tap key
// by performing a tap-release-hold sequence.
// To use it: "&qt KEYCODE1 KEYCODE2"
qt: quick_tap {
compatible = "zmk,behavior-hold-tap";
label = "QUICK_TAP";
#binding-cells = <2>;
flavor = "hold-preferred";
tapping-term-ms = <200>;
quick-tap-ms = <200>;
bindings = <&kp>, <&kp>;
};
};

macros {
// sometimes my device thinks a modifier is being held down
// pressing all modifiers fixes it.
unstick: unstick {
label = "ZM_unstick";
compatible = "zmk,behavior-macro";
#binding-cells = <0>;
bindings = <&kp LSHIFT &kp RSHIFT &kp LCTRL &kp RCTRL &kp LALT &kp RALT &kp LGUI &kp RGUI>;
};
};

combos {
compatible = "zmk,combos";
// both right thumb keys
combo_accent {
timeout-ms = <200>;
key-positions = <32 33>;
bindings = <&mo ACCENT>;
};
// internal-left & external-right thumb keys
combo_sym2 {
timeout-ms = <200>;
key-positions = <31 33>;
bindings = <&mo SYM2>;
};
// both left thumb keys
combo_settings {
timeout-ms = <200>;
key-positions = <30 31>;
bindings = <&mo SETTINGS>;
};
// left index & middle fingers (home-row)
// hold control & space for Adobe workflow
combo_ctrl_space {
timeout-ms = <200>;
key-positions = <12 13>;
bindings = <&kp LC(SPACE)>;
layers = <BASE>;
};
};

keymap {
compatible = "zmk,keymap";
// Base alpha layer
default_layer {
label = "Base";
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 IT_OGRV
&kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp IT_UGRV
&mo EXT &qt LSHIFT SPACE &kp SPACE &sl SYM
>;
};

// Numbers and high frequency symbols
sym_layer {
label = "Sym.";
bindings = <
&kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0
&kp IT_LESS &kp IT_USD &kp IT_LPAR &kp IT_LBRC &kp IT_LBKT &kp IT_EQL &kp IT_QUES &kp IT_SQUOT &kp IT_MINUS &kp IT_AST
&kp IT_GREAT &kp IT_PERC &kp IT_RPAR &kp IT_RBRC &kp IT_RBKT &kp IT_AT &kp IT_EXCL &kp IT_DQUOT &kp IT_PLUS &kp IT_FSLH
&mo FNC &mo SYM2 &trans &trans
>;
};

// Main modifiers and arrow keys
ext_layer {
label = "Mods";
bindings = <
&kp ESC &kp C_PREV &kp C_PP &kp C_NEXT &kp C_PAUSE &kp PG_UP &kp HOME &kp UP &kp END &kp CAPS
&sk LALT &sk LGUI &sk LSHIFT &sk LCTRL &kp RALT &kp PG_DN &kp LEFT &kp DOWN &kp RIGHT &kp DEL
&kp LC(Z) &kp LC(X) &kp LC(C) &kp TAB &kp LC(V) &kp LC(BSPC) &kp BSPC &trans &trans &trans
&trans &kp LCTRL &kp ENTER &mo FNC
>;
};

// Function keys with modifiers
fnc_layer {
label = "FRow";
bindings = <
&kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10
&sk LALT &sk LGUI &sk LSHIFT &sk LCTRL &kp RALT &kp F11 &kp F12 &kp PRINTSCREEN &trans &trans
&none &none &none &none &none &none &none &none &none &none
&none &none &none &none
>;
};

// Low frequency symbols.
symbols_2_layer {
label = "Sym.2";
bindings = <
&kp IT_CARET &kp IT_UNDER &kp IT_PND &kp IT_EUR &kp IT_HASH &none &none &none &none &none
&kp IT_BKTK &kp IT_TILDE &kp IT_BSLH &kp IT_PIPE &kp IT_AND &none &none &none &none &none
&none &none &kp IT_SECT &kp IT_CCED &kp IT_DEG &none &none &none &none &none
&none &none &none &none
>;
};

// Used to type regional accents.
accent_layer {
label = "Accent";
bindings = <
&none &none &none &kp IT_CEGR &none &none &none &none &none &none
&kp IT_AGRV &kp IT_IGRV &kp IT_OGRV &kp IT_EGRV &kp IT_EACU &none &none &none &none &none
&none &none &none &kp IT_UGRV &none &none &none &none &none &none
&none &none &none &none
>;
};

// Used to change the keyboard's settings.
settings_layer {
label = "Sett.";
bindings = <
&bootloader &none &none &bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 3 &none &unstick &none &bootloader
&none &none &none &none &bt BT_SEL 1 &bt BT_SEL 4 &none &none &none &none
&none &none &none &none &bt BT_SEL 2 &bt BT_SEL 5 &none &none &none &none
&none &none &none &none
>;
};
};
};

0 comments on commit 24ec170

Please sign in to comment.