Browse Source

Refactor nibble / update to match build docs (#620)

* feat(nibble): add underglow support for nice_nano builds

* feat(nibble): add encoder to top, left most column to match standard assembly documentation

* refactor(nibble): add layer labels

* feat(nibble): add support for optional display ; off by default

* feat(nibble): add README

* fix(nibble): adjust oled rotation for easier reading

* fix(nibble): add additional note about enabling oled

* refactor(nibble): convert keymap to use tabs instead of spaces

* refactor(nibble): enable oled in dts/overlay by default

* refactor(nibble): cleanup alignment and formatting in nibble keymap

* refactor(nibble): re-align top most row of keymap to be sensible

* refactor(nibble): cleanup kscan map alignment

* refactor(nibble): indent first row of map/transform to properly align with physical columns

* fix(nibble): remove dangling code block from readme

Co-authored-by: KemoNine <mcrosson@kemonine.info>
xmkb
KemoNine 4 years ago committed by GitHub
parent
commit
0499e7e8ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 35
      app/boards/shields/nibble/Kconfig.defconfig
  2. 29
      app/boards/shields/nibble/README.md
  3. 4
      app/boards/shields/nibble/boards/nice_nano.conf
  4. 34
      app/boards/shields/nibble/boards/nice_nano.overlay
  5. 1
      app/boards/shields/nibble/boards/proton_c.conf
  6. 6
      app/boards/shields/nibble/nibble.conf
  7. 58
      app/boards/shields/nibble/nibble.keymap
  8. 39
      app/boards/shields/nibble/nibble.overlay

35
app/boards/shields/nibble/Kconfig.defconfig

@ -11,3 +11,38 @@ config ZMK_USB @@ -11,3 +11,38 @@ config ZMK_USB
endif
if ZMK_DISPLAY
config I2C
default y
config SSD1306
default y
config SSD1306_REVERSE_MODE
default y
endif # ZMK_DISPLAY
if LVGL
config LVGL_HOR_RES_MAX
default 128
config LVGL_VER_RES_MAX
default 32
config LVGL_VDB_SIZE
default 64
config LVGL_DPI
default 148
config LVGL_BITS_PER_PIXEL
default 1
choice LVGL_COLOR_DEPTH
default LVGL_COLOR_DEPTH_1
endchoice
endif # LVGL

29
app/boards/shields/nibble/README.md

@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
# Building ZMK for the Nibble
Some general notes/commands for building standard nibble layouts from the assembly documentation.
## LED Notes
If you built your nibble without the LEDs _and_ are using a nice!nano board, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_ZMK_RGB_UNDERGLOW=n
CONFIG_WS2812_STRIP=n
```
## Encoder Notes
If you built your nibble without an encoder, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_EC11=n
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=n
```
## OLED Builds
If using an OLED screen, you'll need to change the following in your local nibble config or add them to the end of the file.
```
CONFIG_ZMK_DISPLAY=y
```

4
app/boards/shields/nibble/boards/nice_nano.conf

@ -0,0 +1,4 @@ @@ -0,0 +1,4 @@
# Enable underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y

34
app/boards/shields/nibble/boards/nice_nano.overlay

@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
/*
* Copyright (c) 2020 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <11>;
// 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 = <10>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
};
};

1
app/boards/shields/nibble/boards/proton_c.conf

@ -0,0 +1 @@ @@ -0,0 +1 @@
CONFIG_SENSOR=y

6
app/boards/shields/nibble/nibble.conf

@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
# Enable Encoders
CONFIG_EC11=y
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y

58
app/boards/shields/nibble/nibble.keymap

@ -8,30 +8,40 @@ @@ -8,30 +8,40 @@
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#define DEFAULT 0
#define FUNC 1
/ {
keymap {
compatible = "zmk,keymap";
sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder_1>;
};
keymap {
compatible = "zmk,keymap";
default_layer {
label = "Default";
sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&kp C_MUTE &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp DEL
&trans &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&trans &kp LSHFT &trans &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&trans &kp LCTRL &kp LGUI &kp LALT &kp SPACE &mo 1 &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
};
function_layer {
label = "Function";
sensor-bindings = <&inc_dec_kp C_VOLUME_UP C_VOLUME_DOWN>;
default_layer {
bindings = <
&kp ESC &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp MINUS &kp EQUAL &kp BSPC &kp HOME
&kp C_VOL_UP &kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp LBKT &kp RBKT &kp BSLH &kp DEL
&kp C_VOL_DN &kp CLCK &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp SQT &kp RET &kp PG_UP
&trans &kp LSHFT &trans &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp UP &kp PG_DN
&trans &kp LCTRL &kp LGUI &kp LALT &kp SPACE &mo FUNC &kp RALT &kp RCTRL &kp LEFT &kp DOWN &kp RIGHT
>;
};
func {
bindings = <
&kp TILDE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &kp END
&bt BT_CLR &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bootloader
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &kp C_PREV &kp C_PP &kp C_NEXT
>;
};
};
bindings = <
&kp TILDE &kp F1 &kp F2 &kp F3 &kp F4 &kp F5 &kp F6 &kp F7 &kp F8 &kp F9 &kp F10 &kp F11 &kp F12 &trans &kp END
&kp C_MUTE &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &bootloader
&bt BT_CLR &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_PRV &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&bt BT_NXT &trans &trans &trans &trans &trans &trans &trans &kp C_PREV &kp C_PP &kp C_NEXT
>;
};
};
};

39
app/boards/shields/nibble/nibble.overlay

@ -12,6 +12,15 @@ @@ -12,6 +12,15 @@
zmk,matrix_transform = &default_transform;
};
encoder_1: encoder_1 {
compatible = "alps,ec11";
label = "Encoder 1";
a-gpios = <&pro_micro_d 9 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
b-gpios = <&pro_micro_d 8 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
resolution = <4>;
status = "okay";
};
kscan0: kscan {
compatible = "zmk,kscan-gpio-demux";
label = "KSCAN";
@ -36,14 +45,30 @@ @@ -36,14 +45,30 @@
columns = <16>;
rows = <5>;
//TODO: Add a keymap graphic here
map = <
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(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,10) RC(2,11) RC(2,12) RC(2,14) RC(2,15)
RC(3,0) RC(3,1) RC(0,0) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,14) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
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(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14) RC(0,15)
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(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14) RC(1,15)
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(2,10) RC(2,11) RC(2,12) RC(2,14) RC(2,15)
RC(3,0) RC(3,1) RC(0,0) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,14) RC(3,15)
RC(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,6) RC(4,9) RC(4,10) RC(4,11) RC(4,12) RC(4,14) RC(4,15)
>;
};
};
&pro_micro_i2c {
status = "okay";
oled: ssd1306@3c {
compatible = "solomon,ssd1306fb";
reg = <0x3c>;
label = "DISPLAY";
width = <128>;
height = <32>;
segment-offset = <0>;
page-offset = <0>;
display-offset = <0>;
multiplex-ratio = <31>;
com-sequential;
prechargep = <0x22>;
};
};

Loading…
Cancel
Save