Skip to content

Commit

Permalink
working displays
Browse files Browse the repository at this point in the history
  • Loading branch information
LOWPROKB committed Aug 28, 2022
1 parent 0007450 commit 8b1b4dd
Show file tree
Hide file tree
Showing 15 changed files with 397 additions and 151 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"files.associations": {
"*.overlay": "dts",
"*.keymap": "dts"
"*.keymap": "dts",
"peripheral_status.h": "c"
},
"python.formatting.provider": "black"
}
3 changes: 2 additions & 1 deletion app/boards/arm/corne-ish_zen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if(CONFIG_ZMK_DISPLAY)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_BATTERY_STATUS app PRIVATE widgets/battery_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS app PRIVATE widgets/output_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LAYER_STATUS app PRIVATE widgets/layer_status.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS app PRIVATE widgets/peripheral_status.c)
# target_sources_ifdef(CONFIG_ZMK_WIDGET_WPM_STATUS app PRIVATE wpm_status.c)

add_subdirectory_ifdef(CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM widgets/icons)
Expand Down Expand Up @@ -53,7 +54,7 @@ endif()

zephyr_library_include_directories(${ZEPHYR_LVGL_MODULE_DIR})
zephyr_library_include_directories(${ZEPHYR_BASE}/lib/gui/lvgl/)
#zephyr_library_sources_ifdef(CONFIG_ZMK_DISPLAY custom_status_screen.c)
zephyr_library_sources_ifdef(CONFIG_ZMK_DISPLAY custom_status_screen.c)
zephyr_library_sources(${ZEPHYR_BASE}/misc/empty_file.c)
zephyr_library_include_directories(${CMAKE_SOURCE_DIR}/include)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
24 changes: 15 additions & 9 deletions app/boards/arm/corne-ish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ if BOARD_CORNEISH_ZEN_V2_LEFT
config ZMK_KEYBOARD_NAME
default "Corne-ish Zen"

config ZMK_SPLIT_ROLE_CENTRAL
default y

endif # BOARD_CORNEISH_ZEN_V2_LEFT

if BOARD_CORNEISH_ZEN_V2_RIGHT
Expand Down Expand Up @@ -77,9 +80,9 @@ config ZMK_DISPLAY
select LVGL_USE_LABEL
select LVGL_USE_IMG

#choice ZMK_DISPLAY_STATUS_SCREEN
# default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
#endchoice
choice ZMK_DISPLAY_STATUS_SCREEN
default ZMK_DISPLAY_STATUS_SCREEN_CUSTOM
endchoice

if ZMK_DISPLAY

Expand All @@ -101,14 +104,17 @@ config LVGL_DISPLAY_DEV_NAME

endif # ZMK_DISPLAY

#menuconfig CUSTOM_WIDGET_BATTERY_STATUS
# bool "custom battery status widget"
menuconfig CUSTOM_WIDGET_BATTERY_STATUS
bool "custom battery status widget"

menuconfig CUSTOM_WIDGET_OUTPUT_STATUS
bool "custom output status widget"

#menuconfig CUSTOM_WIDGET_OUTPUT_STATUS
# bool "custom output status widget"
menuconfig CUSTOM_WIDGET_LAYER_STATUS
bool "custom layer status widget"

#menuconfig CUSTOM_WIDGET_LAYER_STATUS
# bool "custom layer status widget"
menuconfig CUSTOM_WIDGET_PERIPHERAL_STATUS
bool "custom peripheral status widget"

# config CORNE_ISH_ZEN_20
# bool
Expand Down
6 changes: 3 additions & 3 deletions app/boards/arm/corne-ish_zen/corne-ish_zen_v2_left.dts
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 806000)>;
io-channels = <&adc 0>;
output-ohms = <1960000>;
full-ohms = <(1960000 + 810000)>;
};

};
Expand Down
25 changes: 13 additions & 12 deletions app/boards/arm/corne-ish_zen/corne-ish_zen_v2_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ CONFIG_BOARD_CORNEISH_ZEN_V2_LEFT=y
CONFIG_ZMK_SPLIT=y
#CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL=y
CONFIG_ZMK_SLEEP=y
CONFIG_BUILD_OUTPUT_UF2=y
#CONFIG_BUILD_OUTPUT_UF2=y
CONFIG_ZMK_DISPLAY=y

# Enable MPU
CONFIG_ARM_MPU=y
Expand Down Expand Up @@ -42,12 +43,12 @@ CONFIG_CLOCK_CONTROL_NRF_K32SRC_XTAL=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_30PPM=y

# Enable TI BQ27421 Fuel Gauge
CONFIG_SENSOR=y
#CONFIG_SENSOR=y
#CONFIG_BQ274XX=y
#CONFIG_SENSOR_CAN_FETCH_ALL=n

# enable display drivers
CONFIG_ZMK_DISPLAY=y
#CONFIG_ZMK_DISPLAY=y
CONFIG_ZMK_DISPLAY_WORK_QUEUE_DEDICATED=y
CONFIG_ZMK_DISPLAY_DEDICATED_THREAD_STACK_SIZE=2048
CONFIG_SSD1306=n
Expand All @@ -68,14 +69,14 @@ CONFIG_LVGL_THEME_DEFAULT_FONT_SMALL_MONTSERRAT_16=y
CONFIG_LVGL_THEME_DEFAULT_FONT_NORMAL_MONTSERRAT_26=y

# custom status screens
#CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=y
#CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=y
#CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=y
#CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=n
CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=n
CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=n

# Turn on logging, and set ZMK logging to debug output
CONFIG_LOG=y
Expand All @@ -88,7 +89,7 @@ CONFIG_LOG_STRDUP_BUF_COUNT=160
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
CONFIG_LVGL_LOG_LEVEL_DBG=y
CONFIG_LVGL_USE_DEBUG=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y

# Turn on USB CDC ACM device
CONFIG_ZMK_USB=y
Expand Down
19 changes: 9 additions & 10 deletions app/boards/arm/corne-ish_zen/corne-ish_zen_v2_right_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -65,27 +65,26 @@ CONFIG_LVGL_THEME_DEFAULT_FONT_SMALL_MONTSERRAT_16=y
CONFIG_LVGL_THEME_DEFAULT_FONT_NORMAL_MONTSERRAT_26=y

# custom status screens
#CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=y
#CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
#CONFIG_ZMK_WIDGET_BATTERY_STATUS=y
#CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
#CONFIG_ZMK_WIDGET_OUTPUT_STATUS=y
#CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
#CONFIG_ZMK_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_CUSTOM=y
CONFIG_ZMK_DISPLAY_STATUS_SCREEN_BUILT_IN=n
CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS=y
CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=n

# Turn on logging, and set ZMK logging to debug output
CONFIG_LOG=y
CONFIG_LOG_PROCESS_THREAD_STARTUP_DELAY_MS=8000
CONFIG_ZMK_USB_LOGGING=y
CONFIG_ZMK_LOG_LEVEL_DBG=y
CONFIG_LOG_BUFFER_SIZE=10000
CONFIG_LOG_BUFFER_SIZE=20000
CONFIG_LOG_STRDUP_BUF_COUNT=60
#CONFIG_I2C_LOG_LEVEL_DBG=y
#CONFIG_SPI_LOG_LEVEL_DBG=y
CONFIG_DISPLAY_LOG_LEVEL_DBG=y
#CONFIG_LVGL_LOG_LEVEL_DBG=y
#CONFIG_LVGL_USE_DEBUG=y
CONFIG_SENSOR_LOG_LEVEL_DBG=y
#CONFIG_SENSOR_LOG_LEVEL_DBG=y

# Turn on USB CDC ACM device
CONFIG_ZMK_USB=y
Expand Down
24 changes: 18 additions & 6 deletions app/boards/arm/corne-ish_zen/custom_status_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/

#include "widgets/battery_status.h"
/*#include "widgets/output_status.h"*/
#include "widgets/peripheral_status.h"
#include "widgets/output_status.h"
#include "widgets/layer_status.h"
#include "custom_status_screen.h"

Expand All @@ -21,7 +22,11 @@ static struct zmk_widget_battery_status battery_status_widget;
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS)
//static struct zmk_widget_output_status output_status_widget;
static struct zmk_widget_output_status output_status_widget;
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS)
static struct zmk_widget_peripheral_status peripheral_status_widget;
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_LAYER_STATUS)
Expand All @@ -30,6 +35,7 @@ static struct zmk_widget_layer_status layer_status_widget;

lv_obj_t *zmk_display_status_screen() {


lv_obj_t *screen;
screen = lv_obj_create(NULL, NULL);

Expand All @@ -41,9 +47,15 @@ lv_obj_t *zmk_display_status_screen() {
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS)
/* zmk_widget_output_status_init(&output_status_widget, screen);
zmk_widget_output_status_init(&output_status_widget, screen);
lv_obj_align(zmk_widget_output_status_obj(&output_status_widget), NULL, LV_ALIGN_IN_TOP_MID, 0,
41); */
41);
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS)
zmk_widget_peripheral_status_init(&peripheral_status_widget, screen);
lv_obj_align(zmk_widget_peripheral_status_obj(&peripheral_status_widget), NULL,
LV_ALIGN_IN_TOP_MID, 0, 41);
#endif

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_LAYER_STATUS)
Expand All @@ -54,14 +66,14 @@ lv_obj_t *zmk_display_status_screen() {
-5);
#endif

#if CONFIG_BOARD_CORNEISH_ZEN_RIGHT
#if CONFIG_BOARD_CORNEISH_ZEN_V2_RIGHT
lv_obj_t * zenlogo_icon;
zenlogo_icon = lv_img_create(screen, NULL);
lv_img_set_src(zenlogo_icon, &zenlogo);
lv_obj_align(zenlogo_icon, NULL, LV_ALIGN_IN_BOTTOM_MID, 2, -5);
#endif

#if CONFIG_BOARD_CORNEISH_ZEN_LEFT
#if CONFIG_BOARD_CORNEISH_ZEN_V2_LEFT
lv_obj_t * LayersHeading;
LayersHeading = lv_img_create(screen, NULL);
lv_obj_align(LayersHeading, NULL, LV_ALIGN_IN_BOTTOM_MID, 8, 5);
Expand Down
4 changes: 3 additions & 1 deletion app/boards/arm/corne-ish_zen/custom_status_screen.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@

#pragma once

#include <lvgl.h>
#include <lvgl.h>

lv_obj_t *zmk_display_status_screen();
Loading

0 comments on commit 8b1b4dd

Please sign in to comment.