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

Add files for Spacepad macropad #785

Closed
wants to merge 11 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
9 changes: 9 additions & 0 deletions app/boards/shields/spacepad/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

if SHIELD_SPACEPAD

config ZMK_KEYBOARD_NAME
default "Spacepad v1"

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

config SHIELD_SPACEPAD
def_bool $(shields_list_contains,spacepad)
28 changes: 28 additions & 0 deletions app/boards/shields/spacepad/boards/nice_nano.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
&spi1 {
compatible = "nordic,nrf-spim";
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 = "WS2812";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <12>; /* arbitrary; change at will */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
6 changes: 6 additions & 0 deletions app/boards/shields/spacepad/spacepad.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT

# Uncomment to enable encoder
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y
60 changes: 60 additions & 0 deletions app/boards/shields/spacepad/spacepad.dtsi
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* Copyright (c) 2020 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 = <4>;
rows = <5>;

map = <
RC(0,0) RC(0,1) RC(0,2) RC(0,3)
RC(1,0) RC(1,1) RC(1,2) RC(1,3)
RC(2,0) RC(2,1) RC(2,2) RC(2,3)
RC(3,0) RC(3,1) RC(3,2) RC(3,3)
RC(4,0) RC(4,1) RC(4,2) RC(4,3)
>;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";

diode-direction = "row2col";

row-gpios
= <&pro_micro_d 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 4 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 10 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 16 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;

};

left_encoder: encoder_left {
compatible = "alps,ec11";
label = "LEFT_ENCODER";
a-gpios = <&pro_micro_a 1 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_a 2 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&left_encoder>;
};

// TODO: per-key RGB node(s)?
};
52 changes: 52 additions & 0 deletions app/boards/shields/spacepad/spacepad.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

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

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

default_layer {
// --------------------------
// | 7 | 8 | 9 |
// | 4 | 5 | 6 |
// | 1 | 2 | 3 |
// | M_PLAY | 0 | MO(1) |
// --------------------------
bindings = <
&kp N7 &kp N8 &kp N9 &kp HOME
&kp N4 &kp N5 &kp N6 &kp END
&kp N1 &kp N2 &kp N3 &kp DEL
&kp C_PP &kp N0 &mo 1 &kp PG_DN
&none &none &none &kp INS
>;

sensor-bindings = <&inc_dec_kp INS PG_UP>;
};

nav_layer {
// --------------------------
// | BT_CLR | HOME | PGUP |
// | _ | END | PGDN |
// | _ | _ | _ |
// | _ | _ | _ |
// --------------------------
bindings = <
&bt BT_CLR &trans &kp PG_UP &kp UP
&out OUT_TOG &out OUT_USB &out OUT_BLE &kp DOWN
&reset &trans &trans &kp LEFT
&bootloader &trans &trans &kp RIGHT
&trans &trans &trans &kp INS
>;

sensor-bindings = <&inc_dec_kp A B>;
};
};
};
20 changes: 20 additions & 0 deletions app/boards/shields/spacepad/spacepad.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/

#include "spacepad.dtsi"

&kscan0 {
col-gpios
= <&pro_micro_d 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 7 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 8 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro_d 9 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};

&left_encoder {
status = "okay";
};