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 Levinson support #1648

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions app/boards/shields/levinson/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

if SHIELD_LEVINSON_LEFT

config ZMK_KEYBOARD_NAME
default "Levinson"

config ZMK_SPLIT_BLE_ROLE_CENTRAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config ZMK_SPLIT_BLE_ROLE_CENTRAL
config ZMK_SPLIT_ROLE_CENTRAL

default y

endif

if SHIELD_LEVINSON_LEFT || SHIELD_LEVINSON_RIGHT

config ZMK_SPLIT
default y

endif
8 changes: 8 additions & 0 deletions app/boards/shields/levinson/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Copyright (c) 2023 The ZMK Contributors
# SPDX-License-Identifier: MIT

config SHIELD_LEVINSON_LEFT
def_bool $(shields_list_contains,levinson_left)

config SHIELD_LEVINSON_RIGHT
def_bool $(shields_list_contains,levinson_right)
1 change: 1 addition & 0 deletions app/boards/shields/levinson/levinson.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
CONFIG_ZMK_SLEEP=y
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONFIG_ZMK_SLEEP=y
#CONFIG_ZMK_SLEEP=y

Leaving this uncommented may flout the

  • .conf file has optional extra features commented out

guideline from the PR checklist.

Someone with merge privileges can make a final ruling on that.

34 changes: 34 additions & 0 deletions app/boards/shields/levinson/levinson.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

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

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
diode-direction = "col2row";
};

You may not be able to put col-gpios or row-gpios in here, but these attributes are common so they don't need to be duplicated. (label is deprecated, and has been removed.)

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <12>;
rows = <4>;
// | SW1 | SW2 | SW3 | SW4 | SW5 | SW6 | | SW6 | SW5 | SW4 | SW3 | SW2 | SW1 |
// | SW7 | SW8 | SW9 | SW10 | SW11 | SW12 | | SW12 | SW11 | SW10 | SW9 | SW8 | SW7 |
// | SW13 | SW14 | SW15 | SW16 | SW17 | SW18 | | SW18 | SW17 | SW16 | SW15 | SW14 | SW13 |
// | SW19 | SW20 | SW21 | SW22 | SW23 | SW24 | | SW24 | SW23 | SW22 | SW21 | SW20 | SW19 |

// The Levinson boards are *not* the same for each half and are labeled as either left or right.
// This requires that the right half matrix have its columns inverted.

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,0) RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,11) RC(3,10) RC(3,9) RC(3,8) RC(3,7) RC(3,6)
>;
};
};
115 changes: 115 additions & 0 deletions app/boards/shields/levinson/levinson.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

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

//Layer definitions
#define QWERTY 0
#define COLEMAK 1
#define DVORAK 2
#define LOWER 3
#define RAISE 4
#define ADJ 5

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

qwerty {
// ------------------------------------- -------------------------------------
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BSPC|
// | ESC | A | S | D | F | G | | H | J | K | L | ; | ' |
// |LSHFT| Z | X | C | V | B | | N | M | , | . | / |ENTER|
// | ADJ |LCTRL| LALT| LGUI|LOWER|SPACE| |SPACE|RAISE| LEFT| DOWN| UP |RIGHT|
// ------------------------------------- -------------------------------------
bindings = <
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BSPC
&kp ESC &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ENTER
&mo ADJ &kp LCTRL &kp LALT &kp LGUI &mo LOWER &kp SPACE &kp SPACE &mo RAISE &kp LEFT &kp DOWN &kp UP &kp RIGHT
>;
};

colemak {
// ------------------------------------- -------------------------------------
// | TAB | Q | W | F | P | G | | J | L | U | Y | ; | BSPC|
// | ESC | A | R | S | T | D | | H | N | E | I | O | ' |
// |LSHFT| Z | X | C | V | B | | K | M | , | . | / |ENTER|
// | ADJ |LCTRL| LALT| LGUI|LOWER|SPACE| |SPACE|RAISE| LEFT| DOWN| UP |RIGHT|
// ------------------------------------- -------------------------------------
bindings = <
&kp TAB &kp Q &kp W &kp F &kp P &kp G &kp J &kp L &kp U &kp Y &kp SEMI &kp BSPC
&kp ESC &kp A &kp R &kp S &kp T &kp D &kp H &kp N &kp E &kp I &kp O &kp SQT
&kp LSHFT &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp ENTER
&mo ADJ &kp LCTRL &kp LALT &kp LGUI &mo LOWER &kp SPACE &kp SPACE &mo RAISE &kp LEFT &kp DOWN &kp UP &kp RIGHT
>;
};

dvorak {
// ------------------------------------- -------------------------------------
// | TAB | ' | , | . | P | Y | | F | G | C | R | L | BSPC|
// | ESC | A | O | E | U | I | | D | H | T | N | S | / |
// |LSHFT| ; | Q | J | K | X | | B | M | W | V | Z |ENTER|
// | ADJ |LCTRL| LALT| LGUI|LOWER|SPACE| |SPACE|RAISE| LEFT| DOWN| UP |RIGHT|
// ------------------------------------- -------------------------------------
bindings = <
&kp TAB &kp SQT &kp COMMA &kp DOT &kp P &kp Y &kp F &kp G &kp C &kp R &kp L &kp BSPC
&kp ESC &kp A &kp O &kp E &kp U &kp I &kp D &kp H &kp T &kp N &kp S &kp FSLH
&kp LSHFT &kp SEMI &kp Q &kp J &kp K &kp X &kp B &kp M &kp W &kp V &kp Z &kp ENTER
&mo ADJ &kp LCTRL &kp LALT &kp LGUI &mo LOWER &kp SPACE &kp SPACE &mo RAISE &kp LEFT &kp DOWN &kp UP &kp RIGHT
>;
};

lower {
// ------------------------------------- -------------------------------------
// | ~ | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BSPC|
// | DEL | F1 | F2 | F3 | F4 | F5 | | F6 | _ | + | { | } | | |
// | BL | F7 | F8 | F9 | F10 | F11 | | F12 |LS(#)|LS(\)| | | |
// | | | | | | | | | ADJ | NEXT| Vol-| Vol+| PLAY|
// ------------------------------------- -------------------------------------
bindings = <
&kp TILDE &kp EXCL &kp AT &kp HASH &kp DOLLAR &kp PERCENT &kp CARET &kp AMPS &kp STAR &kp LPAR &kp RPAR &kp BSPC
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE
&rgb_ug RGB_EFF &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp LS(NON_US_HASH) &kp LS(NON_US_BSLH) &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &mo ADJ &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PLAY_PAUSE
>;
};

raise {
// ------------------------------------- -------------------------------------
// | ` | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BSPC|
// | DEL | F1 | F2 | F3 | F4 | F5 | | F6 | - | = | [ | ] | | |
// | | F7 | F8 | F9 | F10 | F11 | | F12 | #~ | \| | | | |
// | | | | | ADJ | | | | | NEXT| Vol-| Vol+| PLAY|
// ------------------------------------- -------------------------------------
bindings = <
&kp GRAVE &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&kp DEL &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp PIPE
&trans &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &kp NON_US_HASH &kp NON_US_BSLH &trans &trans &trans
&trans &trans &trans &trans &mo ADJ &trans &trans &trans &kp C_NEXT &kp C_VOL_DN &kp C_VOL_UP &kp C_PLAY_PAUSE
>;
};

adjust {
// ------------------------------------- -------------------------------------
// | |RESET| | | | | | | | | | | DEL |
// | | | | | | | | |QWERT|COLEM|DVORA| | |
// | | | | | | | | | | | | | |
// | | | | | | | | | | | | | |
// ------------------------------------- -------------------------------------
bindings = <
&trans &bootloader &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp DEL
&trans &trans &trans &trans &trans &trans &trans &to QWERTY &to COLEMAK &to DVORAK &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
>;
};
};
};
13 changes: 13 additions & 0 deletions app/boards/shields/levinson/levinson.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
file_format: "1"
id: levinson
name: Levinson
type: shield
url: https://keeb.io/collections/levinson-keyboard
requires:
- pro_micro
exposes:
features:
- keys
siblings:
- levinson_left
- levinson_right
Empty file.
31 changes: 31 additions & 0 deletions app/boards/shields/levinson/levinson_left.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "levinson.dtsi"

/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
Comment on lines +9 to +13
Copy link
Contributor

@lesshonor lesshonor Nov 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
&kscan0 {

You're going to need to reformat this file to get rid of the extra indentation, but you'll need to run pre-commit after the rebase to clear up formatting issues anyway.


col-gpios
= <&pro_micro 1 GPIO_ACTIVE_HIGH>
, <&pro_micro 3 GPIO_ACTIVE_HIGH>
, <&pro_micro 0 GPIO_ACTIVE_HIGH>
, <&pro_micro 15 GPIO_ACTIVE_HIGH>
, <&pro_micro 14 GPIO_ACTIVE_HIGH>
, <&pro_micro 16 GPIO_ACTIVE_HIGH>
;

row-gpios
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
};

};
Empty file.
35 changes: 35 additions & 0 deletions app/boards/shields/levinson/levinson_right.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2023 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "levinson.dtsi"

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

/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
Comment on lines +13 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/ {
kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";
&kscan0 {


col-gpios
= <&pro_micro 3 GPIO_ACTIVE_HIGH>
, <&pro_micro 0 GPIO_ACTIVE_HIGH>
, <&pro_micro 1 GPIO_ACTIVE_HIGH>
, <&pro_micro 9 GPIO_ACTIVE_HIGH>
, <&pro_micro 8 GPIO_ACTIVE_HIGH>
, <&pro_micro 7 GPIO_ACTIVE_HIGH>
;

row-gpios
= <&pro_micro 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 14 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
};

};