Skip to content

Commit

Permalink
changes of file structure for keyboard layout editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Sadteeto committed Jan 27, 2024
1 parent e853e50 commit b7b26cf
Show file tree
Hide file tree
Showing 7 changed files with 148 additions and 0 deletions.
6 changes: 6 additions & 0 deletions boards/generic-numpad/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
if numpad-generic

config ZMK_KEYBOARD_NAME
default "Generic Numpad"

endif
2 changes: 2 additions & 0 deletions boards/generic-numpad/Kconfig.shield
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config SHIELD_GENERIC_NUMPAD
def_bool $(shields_list_contains,generic-numpad)
46 changes: 46 additions & 0 deletions boards/generic-numpad/boards/nice_nano_v2.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <dt-bindings/led/led.h>

&pinctrl {
spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
};
};

spi3_sleep: spi3_sleep {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 6)>;
low-power-enable;
};
};
};

&spi3 {
compatible = "nordic,nrf-spim";
status = "okay";

pinctrl-0 = <&spi3_default>;
pinctrl-1 = <&spi3_sleep>;
pinctrl-names = "default", "sleep";

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";

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

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

color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
};
};

/ {
chosen {
zmk,underglow = &led_strip;
};
};
5 changes: 5 additions & 0 deletions boards/generic-numpad/generic-numpad.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
CONFIG_ZMK_SLEEP=y
CONFIG_ZMK_KEYBOARD_NAME="Generic Numpad!"
CONFIG_BT_DEVICE_NAME="Generic Numpad!"
CONFIG_BT_DIS_MODEL="Generic Numpad!"
CONFIG_BT_MAX_CONN=3
56 changes: 56 additions & 0 deletions boards/generic-numpad/generic-numpad.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/outputs.h>




// ------------------default-----------------
// | LAYERSFT | / | * | - |
// | 7 | 8 | 9 | + |
// | 4 | 5 | 6 | NOP |
// | 1 | 2 | 3 | ENTER |
// | NOP | 0 | NOP | . |


// ----------------------------functions-------------------------------
// | LAYERSFT | NOP | NOP | Bluetooth PREV |
// | NOP | NOP | NOP | Bluetooth Next |
// | NOP | OUT_TOG | NOP | NOP |
// |Bluetooth 0 | Bluetooth 1 |Bluetooth 2| reset |
// | NOP | BluetoothCLR | NOP | bootloader |

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

default_layer {
bindings = <
&mo 1 &kp KP_DIVIDE &kp KP_MULTIPLY &kp KP_MINUS
&kp KP_N7 &kp KP_N8 &kp KP_N9 &kp KP_PLUS
&kp KP_N4 &kp KP_N5 &kp KP_N6 &trans
&kp KP_N1 &kp KP_N2 &kp KP_N3 &kp KP_ENTER
&trans &kp KP_N0 &trans &kp KP_DOT
>;
};
function_layer {
bindings = <
&trans &trans &trans &trans
&kp DEL &mo 2 &kp BSPC &trans
&trans &out OUT_TOG &trans &trans
&bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &sys_reset
&trans &bt BT_CLR &trans &trans
>;
};
action_layer {
bindings = <
&trans &trans &trans &trans
&trans &trans &trans &trans
&kp LEFT &trans &kp RIGHT &trans
&trans &trans &trans &trans
&trans &trans &trans &bootloader
>;
};
};
};
25 changes: 25 additions & 0 deletions boards/generic-numpad/generic-numpad.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/ {
chosen {
zmk,kscan = &kscan0;
};

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

col-gpios
= <&pro_micro 2 GPIO_ACTIVE_HIGH>
, <&pro_micro 3 GPIO_ACTIVE_HIGH>
, <&pro_micro 4 GPIO_ACTIVE_HIGH>
, <&pro_micro 5 GPIO_ACTIVE_HIGH>
;

row-gpios
= <&pro_micro 21 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 20 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 19 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
, <&pro_micro 15 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>
;
};
};
8 changes: 8 additions & 0 deletions boards/generic-numpad/generic-numpad.zmk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file_format: "1"
id: numpad_generic
name: Generic Numpad
type: shield
url: https://github.com/sadteeto/numpad-generic
requires: [pro_micro]
features:
- keys

0 comments on commit b7b26cf

Please sign in to comment.