-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build against nice view encoders do not need pullups in firmware to work.
- Loading branch information
Showing
7 changed files
with
321 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Copyright (c) 2022 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
if SHIELD_MLEGO_M66_REV4 | ||
|
||
config ZMK_KEYBOARD_NAME | ||
default "mlego m66 rev4" | ||
|
||
config SPI | ||
default y | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Copyright (c) 2022 The ZMK Contributors | ||
# SPDX-License-Identifier: MIT | ||
|
||
config SHIELD_MLEGO_M66_REV4 | ||
def_bool $(shields_list_contains,mlego_m66_rev4) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
CONFIG_USB_DEVICE_MANUFACTURER="alin elena" | ||
CONFIG_USB_DEVICE_VID=0xBABA | ||
CONFIG_USB_DEVICE_PID=0x6068 | ||
CONFIG_USB_DEVICE_PRODUCT="mlego m66 rev4" | ||
|
||
CONFIG_EC11=y | ||
CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y | ||
|
||
|
||
#CONFIG_BOARD_CHARGE_RATE_100MA=y | ||
|
||
#CONFIG_PWM=y | ||
#CONFIG_LED_PWM=y | ||
#CONFIG_LED=y | ||
#CONFIG_LED_GPIO=y | ||
#CONFIG_ZMK_LED_WIDGETS=y | ||
|
||
CONFIG_ZMK_USB_LOGGING=n | ||
|
||
CONFIG_DISPLAY_LOG_LEVEL_ERR=n | ||
|
||
# Enable nice!view | ||
CONFIG_ZMK_DISPLAY=y | ||
CONFIG_SSD1306=n | ||
CONFIG_ZMK_DISPLAY_BLANK_ON_IDLE=n | ||
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=y | ||
CONFIG_ZMK_LV_FONT_DEFAULT_SMALL_MONTSERRAT_26=y | ||
CONFIG_LV_FONT_DEFAULT_MONTSERRAT_26=y |
120 changes: 120 additions & 0 deletions
120
config/boards/shields/mlego_m66_rev4/mlego_m66_rev4.keymap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright (c) 2022-2023 The ZMK Contributors | ||
* | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <behaviors.dtsi> | ||
#include <dt-bindings/zmk/keys.h> | ||
#include <dt-bindings/zmk/outputs.h> | ||
#include <dt-bindings/zmk/rgb.h> | ||
#include <dt-bindings/zmk/bt.h> | ||
|
||
#define QW 0 | ||
#define LWR 2 | ||
#define RSE 1 | ||
#define ADJ 3 | ||
|
||
/ { | ||
|
||
conditional_layers { | ||
compatible = "zmk,conditional-layers"; | ||
tri_layer { | ||
if-layers = <LWR RSE>; | ||
then-layer = <ADJ>; | ||
}; | ||
}; | ||
|
||
behaviors { | ||
tlwr: tlwr { | ||
compatible = "zmk,behavior-tap-dance"; | ||
label = "tlwr"; | ||
#binding-cells = <0>; | ||
tapping-term-ms = <200>; | ||
bindings = <&mo LWR>, <&tog LWR>, <&trans>; | ||
}; | ||
|
||
trse: trse { | ||
compatible = "zmk,behavior-tap-dance"; | ||
label = "trse"; | ||
#binding-cells = <0>; | ||
tapping-term-ms = <200>; | ||
bindings = <&mo RSE>, <&tog RSE>, <&trans>; | ||
}; | ||
}; | ||
|
||
keymap { | ||
compatible = "zmk,keymap"; | ||
|
||
/* | ||
┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐ | ||
│ ⎋ │ 1 │ 2 │ 3 │ 4 │ 5 │ 6 │ 7 │ 8 │ 9 │ 0 │ - │ ⌫ │ 🕨 │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┘ | ||
│ ↹ │ q │ w │ e │ r │ t │ y │ u │ i │ o │ p │ [ │ ] │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ # │ a │ s │ d │ f │ g │ h │ j │ k │ l │ ; │ ' │ ⏎ │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ ⇧( │ \ │ z │ x │ c │ v │ b │ n │ m │ , │ . │ ↑ │ / │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ ⎈ │ │ ⇓ │ ⎇ │ ⇑ │ │ │ │ ⎇ │ ⇧) │ ← │ ↓ │ → │ | ||
└────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘ | ||
*/ | ||
qw_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 BSPC &kp K_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 NON_US_HASH &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp SEMI &kp APOS &kp RET | ||
&kp LSHFT &kp NON_US_BSLH &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp COMMA &kp DOT &kp UP &kp FSLH | ||
&kp LCTRL &kp LGUI &tlwr &kp LALT &trse &kp SPACE &kp SPACE &kp SPACE &kp RALT &kp RSHFT &kp LEFT &kp DOWN &kp RIGHT | ||
>; | ||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; | ||
}; | ||
lower_layer { | ||
bindings = < | ||
&kp GRAVE &kp K_MUTE &kp K_VOL_UP &kp K_VOL_DN &kp K_PREV &kp K_PP &kp K_NEXT &kp LG(P) &kp K_SLEEP &kp K_COFFEE &kp PSCRN &kp DEL &kp EQUAL &trans | ||
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans | ||
&kp CAPS &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 &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans | ||
>; | ||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; | ||
}; | ||
raise_layer { | ||
bindings = < | ||
&kp ESC &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 | ||
&trans &kp F13 &kp F14 &kp F15 &kp F16 &kp F17 &kp F18 &kp F19 &kp F20 &kp F21 &kp F22 &kp F23 &kp F24 | ||
&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 | ||
&trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans | ||
>; | ||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; | ||
}; | ||
|
||
/* | ||
adj layer | ||
* ┌───┬────┬───┬───┬───┬───┬────┬───┬───┬───┬───┬────┬────┐ | ||
* │TOG│bt0 │bt1│bt2│bt3│bt4│ │ │ │ │ │ SPI│ SPD│ | ||
* ├───┼────┼───┼───┼───┼───┼────┼───┼───┼───┼───┼────┼────┤ | ||
* │HUI│HUD │ │ │rst│ │ │ │ │ │ │ EFF│ EFR│ | ||
* ├───┼────┼───┼───┼───┼───┼────┼───┼───┼───┼───┼────┼────┤ | ||
* │SAI│SAD │ │ │ │ │ │ │ │ │ │ │ │ | ||
* ├───┼────┼───┼───┼───┼───┼────┼───┼───┼───┼───┼────┼────┤ | ||
* │BRI│BRD │ │ │ │ │boot│ │ │ │ │bt │ │ | ||
* ├───┼────┼───┼───┼───┼───┼────┼───┼───┼───┼───┼────┼────┤ | ||
* │ ON│OFF │ │ │ │ │ │ │ │USB│btN│btC │ btP│ | ||
* └───┴────┴───┴───┴───┴───┴────┴───┴───┴───┴───┴────┴────┘ | ||
*/ | ||
|
||
adjust_layer { | ||
bindings = < | ||
&rgb_ug RGB_TOG &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &trans &trans &trans &trans &rgb_ug RGB_SPI &rgb_ug RGB_SPD &trans | ||
&rgb_ug RGB_HUI &rgb_ug RGB_HUD &trans &trans &sys_reset &trans &trans &trans &trans &trans &trans &rgb_ug RGB_EFF &rgb_ug RGB_EFR | ||
&rgb_ug RGB_SAI &rgb_ug RGB_SAD &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans | ||
&rgb_ug RGB_BRI &rgb_ug RGB_BRD &trans &trans &trans &trans &bootloader &trans &trans &trans &out OUT_USB &out OUT_BLE &out OUT_TOG | ||
&rgb_ug RGB_ON &rgb_ug RGB_OFF &trans &trans &trans &trans &trans &trans &trans &trans &bt BT_NXT &bt BT_CLR &bt BT_PRV | ||
>; | ||
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>; | ||
}; | ||
|
||
}; | ||
}; |
144 changes: 144 additions & 0 deletions
144
config/boards/shields/mlego_m66_rev4/mlego_m66_rev4.overlay
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* | ||
* Copyright (c) 2022-2023 alin m elena | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <dt-bindings/zmk/matrix_transform.h> | ||
|
||
/ { | ||
model = "mlego m66, rev4"; | ||
|
||
compatible = "mlego", "nice-nano-v2"; | ||
|
||
chosen { | ||
zmk,kscan = &kscan; | ||
zmk,matrix_transform = &m66; | ||
zephyr,display = &nice_view; | ||
}; | ||
|
||
m66: m66_0 { | ||
compatible = "zmk,matrix-transform"; | ||
columns = <14>; | ||
rows = <5>; | ||
/* | ||
┌────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐ | ||
│ 0A │ 0B │ 0C │ 0D │ 0E │ 0F │ 0G │ 0H │ 0I │ 0J │ 0K │ 0L │ 0M │ 0N │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┘ | ||
│ 1A │ 1B │ 1C │ 1D │ 1E │ 1F │ 1G │ 1H │ 1I │ 1J │ 1K │ 1L │ 1M │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ 2A │ 2B │ 2C │ 2D │ 2E │ 2F │ 2G │ 2H │ 2I │ 2J │ 2K │ 2L │ 2M │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ 3A │ 3B │ 3C │ 3D │ 3E │ 3F │ 3G │ 3H │ 3I │ 3J │ 3K │ 3L │ 3M │ | ||
├────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┼────┤ | ||
│ 4A │ 4B │ 4C │ 4D │ 4E │ 4F │ 4G │ 4H │ 4I │ 4J │ 4K │ 4L │ 4M │ | ||
└────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┴────┘ | ||
|
||
*/ | ||
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(0,10) RC(0,11) RC(0,12) RC(0,13) | ||
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(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(3,0) RC(3,1) 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(4,0) RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,6) RC(4,7) RC(4,8) RC(4,9) RC(4,10) RC(4,11) RC(4,12) | ||
>; | ||
}; | ||
kscan: kscan { | ||
compatible = "zmk,kscan-gpio-matrix"; | ||
label = "kscan"; | ||
diode-direction = "col2row"; | ||
col-gpios = <&shift_reg 2 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 9 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 10 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 11 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 12 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 13 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 14 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 15 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 3 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 4 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 5 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 6 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 7 (GPIO_ACTIVE_HIGH)> | ||
, <&shift_reg 1 (GPIO_ACTIVE_HIGH)> | ||
; | ||
row-gpios = <&pro_micro 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&pro_micro 18 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)> | ||
, <&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)> | ||
; | ||
}; | ||
|
||
mlego_encoder: mlego_encoder { | ||
compatible = "alps,ec11"; | ||
label = "mlego encoder"; | ||
a-gpios = <&pro_micro 5 (GPIO_ACTIVE_HIGH )>; | ||
b-gpios = <&pro_micro 4 (GPIO_ACTIVE_HIGH )>; | ||
resolution = <4>; | ||
}; | ||
|
||
sensors { | ||
compatible = "zmk,keymap-sensors"; | ||
sensors = <&mlego_encoder>; | ||
}; | ||
}; | ||
|
||
&mlego_encoder { | ||
status = "okay"; | ||
}; | ||
|
||
&pinctrl { | ||
spi0_default: spi0_default { | ||
group1 { | ||
psels = <NRF_PSEL( SPIM_SCK, 1, 13)> | ||
, <NRF_PSEL(SPIM_MOSI, 0, 10)> | ||
, <NRF_PSEL(SPIM_MISO, 1, 11)> | ||
; | ||
}; | ||
}; | ||
spi0_sleep: spi0_sleep { | ||
group1 { | ||
psels = <NRF_PSEL( SPIM_SCK, 1, 13)> | ||
, <NRF_PSEL(SPIM_MOSI, 0, 10)> | ||
, <NRF_PSEL(SPIM_MISO, 1, 11)> | ||
; | ||
low-power-enable; | ||
}; | ||
}; | ||
}; | ||
|
||
&pro_micro_i2c { | ||
status = "disabled"; | ||
}; | ||
|
||
nice_view_spi: &spi0 { | ||
status = "okay"; | ||
compatible = "nordic,nrf-spim"; | ||
pinctrl-0 = <&spi0_default>; | ||
pinctrl-1 = <&spi0_sleep>; | ||
pinctrl-names = "default", "sleep"; | ||
|
||
cs-gpios = <&pro_micro 10 GPIO_ACTIVE_LOW> | ||
, <&pro_micro 6 GPIO_ACTIVE_HIGH> | ||
; | ||
shift_reg: 595@0 { | ||
compatible = "zmk,gpio-595"; | ||
status = "okay"; | ||
gpio-controller; | ||
spi-max-frequency = <200000>; | ||
#gpio-cells = <2>; | ||
reg = <0>; | ||
label = "4HC595"; | ||
ngpios = <16>; | ||
}; | ||
|
||
nice_view: ls0xx@0 { | ||
compatible = "sharp,ls0xx"; | ||
label = "DISPLAY"; | ||
disp-en-gpios = <&pro_micro 9 GPIO_ACTIVE_LOW>; | ||
spi-max-frequency = <1000000>; | ||
reg = <0>; | ||
width = <128>; | ||
height = <128>; | ||
}; | ||
}; |
12 changes: 12 additions & 0 deletions
12
config/boards/shields/mlego_m66_rev4/mlego_m66_rev4.zmk.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
file_format: "1" | ||
id: mlego_m66_rev4 | ||
name: mlego m6 rev4 | ||
type: shield | ||
url: https://mlego.elena.space | ||
requires: [nice_view_header] | ||
exposes: | ||
- i2c_encoder | ||
features: | ||
- keys | ||
- encoder | ||
- display |