Merge pull request #3 from nvhung9/main

update_bongocat_mousekey
This commit is contained in:
nvhung9 2022-11-09 15:15:33 +07:00 committed by GitHub
commit 41ebd22fea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 224 additions and 54 deletions

View file

@ -0,0 +1,39 @@
#include <dt-bindings/led/led.h>
&spi1 {
compatible = "nordic,nrf-spim";
/* Cannot be used together with i2c0. */
status = "okay";
mosi-pin = <6>; //gpio 0.06
// 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>;
spi-max-frequency = <5250000>;
/* WS2812 */
chain-length = <27>; /* number of LEDs */
spi-one-frame = <0x70>; /* make sure to configure this properly for your SOC */
spi-zero-frame = <0x40>; /* make sure to configure this properly for your SOC */
color-mapping = <LED_COLOR_ID_GREEN
LED_COLOR_ID_RED
LED_COLOR_ID_BLUE>;
};
};
/ {
chosen {
zmk,underglow = &led_strip;
zmk,battery = &vbatt;
};
};

View file

@ -1,6 +1,36 @@
# Uncomment the following lines to enable the Corne RGB Underglow
# CONFIG_ZMK_RGB_UNDERGLOW=y
# CONFIG_WS2812_STRIP=y
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y
# Uncomment the following line to enable the Corne OLED Display
# CONFIG_ZMK_DISPLAY=y
CONFIG_ZMK_DISPLAY=y
#CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=n
# Enable a widget to show words per minute
# CONFIG_ZMK_WIDGET_WPM_STATUS=n
# CONFIG_ZMK_WIDGET_LAYER_STATUS=n
# CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=n
# Bongo cat
# CONFIG_ZMK_WIDGET_BONGO_CAT=y
# Mouse key
CONFIG_ZMK_MOUSE=y
# OLED Reverse "black on white" or "white on black"
CONFIG_SSD1306_REVERSE_MODE=y
# Milliseconds of inactivity before entering idle state (5 minute)
# CONFIG_ZMK_IDLE_TIMEOUT=300000
# Enable deep sleep support
CONFIG_ZMK_SLEEP=y
# Milliseconds of inactivity before entering deep sleep (15 minutes)
CONFIG_ZMK_IDLE_SLEEP_TIMEOUT=900000

View file

@ -3,54 +3,121 @@
*
* SPDX-License-Identifier: MIT
*/
/* THIS FILE WAS GENERATED!
*
* This file was generated automatically. You may or may not want to
* edit it directly
*/
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>
#include <dt-bindings/zmk/rgb.h>
#include <dt-bindings/zmk/backlight.h>
#include <dt-bindings/zmk/ext_power.h>
#include <dt-bindings/zmk/outputs.h>
#include <dt-bindings/zmk/mouse.h>
/ {
keymap {
compatible = "zmk,keymap";
default_layer {
// -----------------------------------------------------------------------------------------
// | TAB | Q | W | E | R | T | | Y | U | I | O | P | BKSP |
// | CTRL | A | S | D | F | G | | H | J | K | L | ; | ' |
// | SHFT | Z | X | C | V | B | | N | M | , | . | / | ESC |
// | GUI | LWR | SPC | | ENT | RSE | ALT |
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 LCTRL &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 ESC
&kp LGUI &mo 1 &kp SPACE &kp RET &mo 2 &kp RALT
>;
};
lower_layer {
// -----------------------------------------------------------------------------------------
// | TAB | 1 | 2 | 3 | 4 | 5 | | 6 | 7 | 8 | 9 | 0 | BKSP |
// | BTCLR| BT1 | BT2 | BT3 | BT4 | BT5 | | LFT | DWN | UP | RGT | | |
// | SHFT | | | | | | | | | | | | |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp N1 &kp N2 &kp N3 &kp N4 &kp N5 &kp N6 &kp N7 &kp N8 &kp N9 &kp N0 &kp BSPC
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &kp LEFT &kp DOWN &kp UP &kp RIGHT &trans &trans
&kp LSHFT &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};
raise_layer {
// -----------------------------------------------------------------------------------------
// | TAB | ! | @ | # | $ | % | | ^ | & | * | ( | ) | BKSP |
// | CTRL | | | | | | | - | = | [ | ] | \ | ` |
// | SHFT | | | | | | | _ | + | { | } | "|" | ~ |
// | GUI | | SPC | | ENT | | ALT |
bindings = <
&kp TAB &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp BSPC
&kp LCTRL &trans &trans &trans &trans &trans &kp MINUS &kp EQUAL &kp LBKT &kp RBKT &kp BSLH &kp GRAVE
&kp LSHFT &trans &trans &trans &trans &trans &kp UNDER &kp PLUS &kp LBRC &kp RBRC &kp PIPE &kp TILDE
&kp LGUI &trans &kp SPACE &kp RET &trans &kp RALT
>;
};
};
#define LOWER 1
#define RAISE 2
#define SHIFT 3
#define OPTION 4
#define LOCK 5
&mmv {
time-to-max-speed-ms = <1000>;
acceleration-exponent=<1>;
};
&mwh {
time-to-max-speed-ms = <2000>;
acceleration-exponent=<0>;
};
/ {
behaviors {
hm: homerow_mods {
compatible = "zmk,behavior-hold-tap";
label = "homerow mods";
#binding-cells = <2>;
tapping_term_ms = <200>;
flavor = "tap-preferred";
bindings =
<&kp>,
<&kp>;
};
};
conditional_layers {
compatible = "zmk,conditional-layers";
tri_layer {
if-layers = <LOWER RAISE>;
then-layer = <OPTION>;
};
};
macros {
macro1: macro1 {
compatible = "zmk,behavior-macro";
label = "new_macro";
#binding-cells = <0>;
bindings = <&kp P &kp DOT &kp T &kp KP_MULTIPLY &kp NUMBER_0 &kp NUMBER_9 &kp NUMBER_8 &kp NUMBER_1 &kp NUMBER_6 &kp NUMBER_7 &kp NUMBER_9 &kp NUMBER_9 &kp NUMBER_0 &kp NUMBER_2 &kp PLUS &kp T &kp DOT &kp T &kp KP_MULTIPLY &kp PLUS &kp R &kp DOT &kp H>;
};
};
keymap {
compatible = "zmk,keymap";
default_layer {
bindings = <
&kp TAB &kp Q &kp W &kp E &kp R &kp T &kp Y &kp U &kp I &kp O &kp P &kp BACKSPACE
&kp LSHFT &kp A &kp S &kp D &kp F &kp G &kp H &kp J &kp K &kp L &kp UP &kp ENTER
&kp LCTRL &kp Z &kp X &kp C &kp V &kp B &kp N &kp M &kp SLASH &kp LEFT &kp DOWN &kp RIGHT
&kp LGUI &mo LOWER &hm LALT SPACE &kp SPACE &mo RAISE &hm RCTRL INSERT
>;
};
// number and mouse keys
layer_lower {
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
&mo SHIFT &mwh SCROLL_VERT(-15) &mwh SCROLL_VERT(15) &mmv MOVE_VERT(-1500) &mkp LCLK &mkp RCLK &mkp LCLK &mkp MCLK &kp BSLH &kp SEMICOLON &kp SINGLE_QUOTE &kp EQUAL
&trans &mwh SCROLL_HOR(-15) &mmv MOVE_HOR(-1500) &mmv MOVE_VERT(1500) &mmv MOVE_HOR(1500) &mwh SCROLL_HOR(15) &trans &trans &kp QUESTION &kp COMMA &kp DOT &trans
&trans &trans &trans &kp LEFT_BRACE &trans &kp RIGHT_BRACE
>;
};
// F key and media
layer_raise {
bindings = <
&kp F1 &kp F2 &kp F3 &kp F4 &trans &trans &trans &trans &trans &trans &kp PAUSE_BREAK &kp DELETE
&kp F5 &kp F6 &kp F7 &kp F8 &trans &trans &kp HOME &kp END &trans &trans &trans &kp K_CMENU
&kp F9 &kp F10 &kp F11 &kp F12 &trans &trans &kp PG_UP &kp PG_DN &kp C_AL_CALCULATOR &kp C_VOLUME_DOWN &kp C_PLAY_PAUSE &kp C_VOLUME_UP
&trans &trans &trans &kp HOME &trans &kp END
>;
};
// symbol
Layer_SHIFT {
bindings = <
&kp TILDE &kp EXCL &kp AT &kp HASH &kp DLLR &kp PRCNT &kp CARET &kp AMPS &kp KP_MULTIPLY &kp LPAR &kp RPAR &kp UNDERSCORE
&trans &trans &trans &trans &trans &trans &trans &trans &kp PIPE &kp COLON &kp DOUBLE_QUOTES &kp PLUS
&kp PRINTSCREEN &trans &trans &trans &trans &trans &trans &trans &trans &kp LESS_THAN &kp GREATER_THAN &kp CAPSLOCK
&trans &trans &trans &kp LBKT &trans &kp RBKT
>;
};
Layer_option {
bindings = <
&bt BT_CLR &bt BT_SEL 0 &bt BT_SEL 1 &bt BT_SEL 2 &bt BT_SEL 3 &bt BT_SEL 4 &trans &trans &trans &kp C_BRI_DN &kp C_BRI_UP &tog LOCK
&trans &rgb_ug RGB_SPI &rgb_ug RGB_HUI &rgb_ug RGB_SAI &rgb_ug RGB_EFF &rgb_ug RGB_BRI &trans &trans &trans &kp C_PREV &kp C_NEXT &out OUT_TOG
&reset &rgb_ug RGB_SPD &rgb_ug RGB_HUD &rgb_ug RGB_SAD &rgb_ug RGB_EFR &rgb_ug RGB_BRD &reset &trans &trans &kp C_VOLUME_DOWN &kp C_PLAY_PAUSE &kp C_VOLUME_UP
&bootloader &trans &ext_power EP_TOG &rgb_ug RGB_TOG &trans &bootloader
>;
};
// 3 phim Lower+Raise+Backspace bat/tat che do khoa phim
lock_layer {
bindings = <
&none &none &none &none &none &none &none &none &none &none &none &trans
&none &none &none &none &none &none &none &none &none &none &none &none
&none &none &none &none &none &none &none &none &none &none &none &none
&none &trans &none &none &trans &none
>;
};
};
};

View file

@ -0,0 +1,17 @@
# Uncomment the following lines to enable the Corne RGB Underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y
# Corne OLED Display
CONFIG_ZMK_DISPLAY=y
#CONFIG_ZMK_WIDGET_BONGO_CAT=y
# CONFIG_ZMK_WIDGET_LUNA=y
CONFIG_ZMK_WIDGET_WPM_STATUS=n
CONFIG_ZMK_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=y
# label
#CONFIG_ZMK_WIDGET_LABEL=y
#CONFIG_ZMK_WIDGET_LABEL_TEXT="---- Mr_Hung"

View file

@ -0,0 +1,16 @@
# Uncomment the following lines to enable the Corne RGB Underglow
CONFIG_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y
# Corne OLED Display
CONFIG_ZMK_DISPLAY=y
CONFIG_ZMK_WIDGET_BONGO_CAT=y
# CONFIG_ZMK_WIDGET_LUNA=y
# CONFIG_ZMK_WIDGET_WPM_STATUS=y
#CONFIG_ZMK_WIDGET_BATTERY_STATUS=y
#CONFIG_ZMK_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=y
# CONFIG_ZMK_WIDGET_LABEL=y
# CONFIG_ZMK_WIDGET_LABEL_TEXT="_____Mr.Hung1"

View file

@ -13,7 +13,7 @@ if ZMK_DISPLAY
config ZMK_DISPLAY_BLANK_ON_IDLE
bool "Blank display on idle"
default y
default n
choice LVGL_TXT_ENC
default LVGL_TXT_ENC_UTF8

View file

@ -6,7 +6,7 @@ menu "ZMK Display Widgets"
config ZMK_WIDGET_LAYER_STATUS
bool "Widget for highest, active layer using small icons"
default y
depends on !ZMK_SPLIT || ZMK_SPLIT_ROLE_CENTRAL
depends on ZMK_SPLIT && ZMK_SPLIT_ROLE_CENTRAL
select LVGL_USE_LABEL
config ZMK_WIDGET_BATTERY_STATUS
@ -35,7 +35,8 @@ config ZMK_WIDGET_WPM_STATUS
config ZMK_WIDGET_BONGO_CAT
bool "Widget for displaying bongo cat"
depends on !ZMK_SPLIT || ZMK_SPLIT_BLE_ROLE_CENTRAL
depends on BT
default y if BT
select LVGL_USE_LABEL
select LVGL_USE_IMG

View file

@ -49,7 +49,7 @@ static void set_battery_symbol(lv_obj_t *label, struct battery_status_state stat
strcat(text, LV_SYMBOL_BATTERY_EMPTY);
}
lv_label_set_text(label, text);
lv_obj_align(label, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_align(label, NULL, LV_ALIGN_IN_BOTTOM_LEFT, 30, 0);
}
void battery_status_update_cb(struct battery_status_state state) {
@ -77,7 +77,7 @@ ZMK_SUBSCRIPTION(widget_battery_status, zmk_usb_conn_state_changed);
int zmk_widget_battery_status_init(struct zmk_widget_battery_status *widget, lv_obj_t *parent) {
widget->obj = lv_label_create(parent, NULL);
lv_obj_set_size(widget->obj, 43, 15);
lv_obj_set_size(widget->obj, 0, 0);
sys_slist_append(&widgets, &widget->node);

View file

@ -83,7 +83,7 @@ ZMK_SUBSCRIPTION(widget_output_status, zmk_ble_active_profile_changed);
int zmk_widget_output_status_init(struct zmk_widget_output_status *widget, lv_obj_t *parent) {
widget->obj = lv_label_create(parent, NULL);
lv_obj_set_size(widget->obj, 40, 15);
lv_obj_set_size(widget->obj, 30, 12);
sys_slist_append(&widgets, &widget->node);