From b0eadd45d1dba42ac19bd2bc8a4567d087e63288 Mon Sep 17 00:00:00 2001 From: Kyle McCreery Date: Tue, 18 Oct 2022 10:06:50 -0400 Subject: [PATCH] Working for everything not related to the touchpad --- .../shields/sugarglider/Kconfig.defconfig | 14 +++++++ .../shields/sugarglider/boards/pillbug.conf | 4 +- .../shields/sugarglider/sugarglider.conf | 20 ++++++++-- .../shields/sugarglider/sugarglider.keymap | 16 ++++++-- .../shields/sugarglider/sugarglider.overlay | 39 ++++++++++++++++++- 5 files changed, 82 insertions(+), 11 deletions(-) diff --git a/app/boards/shields/sugarglider/Kconfig.defconfig b/app/boards/shields/sugarglider/Kconfig.defconfig index c75c7115..1cb9eafd 100644 --- a/app/boards/shields/sugarglider/Kconfig.defconfig +++ b/app/boards/shields/sugarglider/Kconfig.defconfig @@ -6,6 +6,20 @@ if SHIELD_SUGARGLIDER config ZMK_KEYBOARD_NAME default "Sugar Glider" +if ZMK_DISPLAY + +config I2C + default y + +config SSD1306 + default y + +config SSD1306_REVERSE_MODE + default y + +endif # ZMK_DISPLAY + + if LVGL config LVGL_VDB_SIZE diff --git a/app/boards/shields/sugarglider/boards/pillbug.conf b/app/boards/shields/sugarglider/boards/pillbug.conf index 83effb38..dda71c13 100644 --- a/app/boards/shields/sugarglider/boards/pillbug.conf +++ b/app/boards/shields/sugarglider/boards/pillbug.conf @@ -1,3 +1,3 @@ # Uncomment both to enable underglow -#CONFIG_ZMK_RGB_UNDERGLOW=y -#CONFIG_WS2812_STRIP=y +CONFIG_ZMK_RGB_UNDERGLOW=y +CONFIG_WS2812_STRIP=y diff --git a/app/boards/shields/sugarglider/sugarglider.conf b/app/boards/shields/sugarglider/sugarglider.conf index b796acd1..43875315 100644 --- a/app/boards/shields/sugarglider/sugarglider.conf +++ b/app/boards/shields/sugarglider/sugarglider.conf @@ -1,11 +1,11 @@ # Uncomment to turn on logging, and set ZMK logging to debug output CONFIG_ZMK_USB_LOGGING=y -#CONFIG_I2C_LOG_LEVEL_DBG=y -CONFIG_GPIO_LOG_LEVEL_DBG=y +CONFIG_I2C_LOG_LEVEL_DBG=y +#CONFIG_GPIO_LOG_LEVEL_DBG=y # Uncomment both to enable encoder -#CONFIG_EC11=y -#CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y +CONFIG_EC11=y +CONFIG_EC11_TRIGGER_GLOBAL_THREAD=y # Enable i2c CONFIG_I2C=y @@ -15,4 +15,16 @@ CONFIG_PINCTRL=y CONFIG_ZMK_KSCAN_MATRIX_POLLING=y CONFIG_GPIO_MCP230XX=y +#CONFIG_ZMK_KSCAN_MATRIX_WAIT_BEFORE_INPUTS=150 +#CONFIG_ZMK_KSCAN_MATRIX_WAIT_BETWEEN_OUTPUTS=150 +# OLED config +CONFIG_ZMK_DISPLAY=y +CONFIG_SSD1306=y +CONFIG_SSD1306_REVERSE_MODE=y +CONFIG_LVGL_HOR_RES_MAX=128 +CONFIG_LVGL_VER_RES_MAX=64 +CONFIG_LVGL_VDB_SIZE=64 +CONFIG_LVGL_DPI=148 +CONFIG_LVGL_BITS_PER_PIXEL=1 +CONFIG_LVGL_COLOR_DEPTH_1=y diff --git a/app/boards/shields/sugarglider/sugarglider.keymap b/app/boards/shields/sugarglider/sugarglider.keymap index b5c370e1..e19140e7 100644 --- a/app/boards/shields/sugarglider/sugarglider.keymap +++ b/app/boards/shields/sugarglider/sugarglider.keymap @@ -11,7 +11,7 @@ #include #include -#define TIMEOUT 100 +#define TIMEOUT 10 &encoder_1 { status = "okay"; @@ -21,11 +21,19 @@ status = "okay"; }; +&encoder_3 { + status = "okay"; +}; + +&encoder_4 { + status = "okay"; +}; + / { sensors { compatible = "zmk,keymap-sensors"; - sensors = <&encoder_1 &encoder_2>; + sensors = <&encoder_1 &encoder_2 &encoder_3 &encoder_4>; }; @@ -40,7 +48,7 @@ &kp LSHFT &kp Z &kp X &kp C &kp V &kp B &trans &kp N &kp M &kp COMMA &kp DOT &kp FSLH &kp RSHFT &kp C_MUTE &kp LCTRL &kp LALT &kp SPACE &kp Y &kp Y &kp Y &kp SPACE &kp SPACE &kp RGUI &kp C_MUTE >; - sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN>; + sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp C_VOL_UP C_VOL_DN>; }; @@ -52,7 +60,7 @@ &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &trans &kp TAB &trans &trans &trans &kp TAB &trans &trans &trans >; - sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN>; + sensor-bindings = <&inc_dec_kp PG_UP PG_DN &inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp C_VOL_UP C_VOL_DN &inc_dec_kp C_VOL_UP C_VOL_DN>; }; }; diff --git a/app/boards/shields/sugarglider/sugarglider.overlay b/app/boards/shields/sugarglider/sugarglider.overlay index 96c2d4a8..cd012041 100644 --- a/app/boards/shields/sugarglider/sugarglider.overlay +++ b/app/boards/shields/sugarglider/sugarglider.overlay @@ -8,6 +8,7 @@ / { chosen { + zephyr,display = &oled; zmk,kscan = &kscan0; zmk,matrix_transform = &default_transform; }; @@ -17,6 +18,7 @@ label = "KSCAN"; diode-direction = "row2col"; + debounce-scan-period-ms = <10>; row-gpios = <&ext_gpio 14 (GPIO_ACTIVE_LOW)> , <&ext_gpio 15 (GPIO_ACTIVE_LOW)> @@ -68,6 +70,28 @@ status = "disabled"; }; + encoder_3: encoder_3 { + compatible = "alps,ec11"; + label = "Encoder 3"; + a-gpios = <&blackpill 45 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&blackpill 46 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <4>; + status = "disabled"; + }; + + + encoder_4: encoder_4 { + compatible = "alps,ec11"; + label = "Encoder 4"; + a-gpios = <&blackpill 4 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + b-gpios = <&blackpill 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>; + resolution = <2>; + status = "disabled"; + }; +}; + +&spi1 { + cs-gpios = <&gpio0 3 GPIO_ACTIVE_HIGH>; }; &i2c0 { @@ -83,5 +107,18 @@ #gpio-cells = <2>; ngpios = <16>; }; + + oled: ssd1306@3c { + compatible = "solomon,ssd1306fb"; + status = "okay"; + reg = <0x3c>; + label = "DISPLAY"; + width = <128>; + height = <64>; + segment-offset = <0>; + page-offset = <0>; + display-offset = <0>; + multiplex-ratio = <63>; + prechargep = <0x22>; + }; }; -