Skip to content

Commit

Permalink
Add selectable logo images
Browse files Browse the repository at this point in the history
  • Loading branch information
manna-harbour authored and caksoylar committed Dec 7, 2023
1 parent 9d46a2c commit b74dffe
Show file tree
Hide file tree
Showing 8 changed files with 226 additions and 2 deletions.
5 changes: 4 additions & 1 deletion app/boards/arm/corneish_zen/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ if(CONFIG_ZMK_DISPLAY)
zephyr_library_sources(widgets/icons/layers2.c)
endif()
if(NOT CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
zephyr_library_sources(widgets/icons/zenlogo.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZEN app PRIVATE widgets/icons/zenlogo.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_LPKB app PRIVATE widgets/icons/lpkblogo.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZMK app PRIVATE widgets/icons/zmklogo.c)
target_sources_ifdef(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_MIRYOKU app PRIVATE widgets/icons/miryokulogo.c)
endif()
endif()

Expand Down
17 changes: 17 additions & 0 deletions app/boards/arm/corneish_zen/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,23 @@ menuconfig CUSTOM_WIDGET_PERIPHERAL_STATUS
config CUSTOM_WIDGET_LAYER_STATUS_HIDE_HEADING
bool "Hide heading strip for layer widget and center widgets on 1/3rds"

choice CUSTOM_WIDGET_LOGO_IMAGE
prompt "custom logo widget image"

config CUSTOM_WIDGET_LOGO_IMAGE_ZEN
bool "Corne-ish Zen"

config CUSTOM_WIDGET_LOGO_IMAGE_LPKB
bool "LPKB"

config CUSTOM_WIDGET_LOGO_IMAGE_ZMK
bool "ZMK"

config CUSTOM_WIDGET_LOGO_IMAGE_MIRYOKU
bool "Miryoku"

endchoice

endif # BOARD_CORNEISH_ZEN_LEFT || BOARD_CORNEISH_ZEN_RIGHT

if BOARD_CORNEISH_ZEN_V1_LEFT || BOARD_CORNEISH_ZEN_V1_RIGHT
Expand Down
1 change: 1 addition & 0 deletions app/boards/arm/corneish_zen/corneish_zen_v2_left_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ CONFIG_CUSTOM_WIDGET_OUTPUT_STATUS=y
CONFIG_ZMK_WIDGET_OUTPUT_STATUS=n
CONFIG_CUSTOM_WIDGET_LAYER_STATUS=y
CONFIG_ZMK_WIDGET_LAYER_STATUS=n
CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZEN=y

# Turn on logging, and set ZMK logging to debug output
#CONFIG_LOG=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CONFIG_CUSTOM_WIDGET_BATTERY_STATUS=y
CONFIG_ZMK_WIDGET_BATTERY_STATUS=n
CONFIG_CUSTOM_WIDGET_PERIPHERAL_STATUS=y
CONFIG_ZMK_WIDGET_PERIPHERAL_STATUS=n
CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZEN=y

# Turn on logging, and set ZMK logging to debug output
#CONFIG_LOG=y
Expand Down
13 changes: 12 additions & 1 deletion app/boards/arm/corneish_zen/custom_status_screen.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_DECLARE(zmk, CONFIG_ZMK_LOG_LEVEL);

LV_IMG_DECLARE(zenlogo);
LV_IMG_DECLARE(layers2);

#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_BATTERY_STATUS)
Expand Down Expand Up @@ -88,7 +87,19 @@ lv_obj_t *zmk_display_status_screen() {
#if !IS_ENABLED(CONFIG_ZMK_SPLIT_ROLE_CENTRAL)
lv_obj_t *zenlogo_icon;
zenlogo_icon = lv_img_create(screen);
#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZEN)
LV_IMG_DECLARE(zenlogo);
lv_img_set_src(zenlogo_icon, &zenlogo);
#elif IS_ENABLED(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_LPKB)
LV_IMG_DECLARE(lpkblogo);
lv_img_set_src(zenlogo_icon, &lpkblogo);
#elif IS_ENABLED(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_ZMK)
LV_IMG_DECLARE(zmklogo);
lv_img_set_src(zenlogo_icon, &zmklogo);
#elif IS_ENABLED(CONFIG_CUSTOM_WIDGET_LOGO_IMAGE_MIRYOKU)
LV_IMG_DECLARE(miryokulogo);
lv_img_set_src(zenlogo_icon, &miryokulogo);
#endif
#if IS_ENABLED(CONFIG_CUSTOM_WIDGET_LAYER_STATUS_HIDE_HEADING)
lv_obj_align(zenlogo_icon, LV_ALIGN_CENTER, 0, 43);
#else
Expand Down
67 changes: 67 additions & 0 deletions app/boards/arm/corneish_zen/widgets/icons/lpkblogo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
*
* Copyright (c) 2021 Darryl deHaan
* SPDX-License-Identifier: MIT
*
*/

#include <lvgl.h>

#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

#ifndef LV_ATTRIBUTE_IMG_LPKBLOGO
#define LV_ATTRIBUTE_IMG_LPKBLOGO
#endif

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_LPKBLOGO uint8_t lpkblogo_map[] = {
0xff, 0xff, 0xff, 0xff, /*Color of index 0*/
0x00, 0x00, 0x00, 0xff, /*Color of index 1*/

0x7f, 0xff, 0xff, 0xff, 0xc0,
0xff, 0xff, 0xff, 0xff, 0xe0,
0xe0, 0x00, 0x00, 0x00, 0xe0,
0xc0, 0x00, 0x00, 0x00, 0x60,
0xc7, 0x83, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc3, 0xff, 0xfc, 0x60,
0xcf, 0xc0, 0x00, 0xfc, 0x60,
0xcf, 0xc0, 0x00, 0xfc, 0x60,
0xcf, 0xc0, 0x00, 0xfc, 0x60,
0xcf, 0xc0, 0x00, 0xfc, 0x60,
0xcf, 0xc3, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc3, 0xff, 0xfc, 0x60,
0xcf, 0xc0, 0x00, 0x00, 0x60,
0xcf, 0xc0, 0x00, 0x00, 0x60,
0xcf, 0xc0, 0x00, 0x00, 0x60,
0xcf, 0xc0, 0x00, 0x00, 0x60,
0xcf, 0xc0, 0x00, 0x00, 0x60,
0xcf, 0xc3, 0xff, 0xf8, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xcf, 0xc7, 0xff, 0xfc, 0x60,
0xc7, 0x83, 0xff, 0xf8, 0x60,
0xc0, 0x00, 0x00, 0x00, 0x60,
0xe0, 0x00, 0x00, 0x00, 0xe0,
0xff, 0xff, 0xff, 0xff, 0xe0,
0x7f, 0xff, 0xff, 0xff, 0xc0,
};

const lv_img_dsc_t lpkblogo = {
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 35,
.header.h = 35,
.data_size = 183,
.data = lpkblogo_map,
};
59 changes: 59 additions & 0 deletions app/boards/arm/corneish_zen/widgets/icons/miryokulogo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
// Copyright 2022 Manna Harbour
// https://github.com/manna-harbour/miryoku

#include "lvgl.h"

#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

#ifndef LV_ATTRIBUTE_IMG_MIRYOKULOGO
#define LV_ATTRIBUTE_IMG_MIRYOKULOGO
#endif

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_MIRYOKULOGO uint8_t miryokulogo_map[] = {
0x04, 0x02, 0x04, 0xff, /*Color of index 0*/
0xfc, 0xfe, 0xfc, 0xff, /*Color of index 1*/

0xff, 0xff, 0xff, 0xff,
0x80, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x01,
0x9f, 0xff, 0xff, 0xf9,
0x9f, 0xff, 0xff, 0xf9,
0x98, 0x01, 0x99, 0x99,
0x98, 0x01, 0x99, 0x99,
0x99, 0x99, 0x80, 0x19,
0x99, 0x99, 0x80, 0x19,
0x98, 0x01, 0xf9, 0xf9,
0x98, 0x01, 0xf9, 0xf9,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x98, 0x01, 0x80, 0x19,
0x98, 0x01, 0x80, 0x19,
0x9f, 0x9f, 0xf9, 0xf9,
0x9f, 0x9f, 0xf9, 0xf9,
0x98, 0x01, 0x80, 0x19,
0x98, 0x01, 0x80, 0x19,
0x99, 0x99, 0x99, 0x99,
0x99, 0x99, 0x99, 0x99,
0x99, 0x81, 0x99, 0x99,
0x99, 0x81, 0x99, 0x99,
0x99, 0x9f, 0x99, 0x99,
0x99, 0x9f, 0x99, 0x99,
0x99, 0x80, 0x19, 0x99,
0x99, 0x80, 0x19, 0x99,
0x9f, 0xff, 0xff, 0xf9,
0x9f, 0xff, 0xff, 0xf9,
0x80, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x01,
0xff, 0xff, 0xff, 0xff,
};

const lv_img_dsc_t miryokulogo = {
.header.always_zero = 0,
.header.w = 32,
.header.h = 32,
.data_size = 136,
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.data = miryokulogo_map,
};
65 changes: 65 additions & 0 deletions app/boards/arm/corneish_zen/widgets/icons/zmklogo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#include "lvgl.h"

#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif

#ifndef LV_ATTRIBUTE_IMG_ZMKLOGO
#define LV_ATTRIBUTE_IMG_ZMKLOGO
#endif

const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_LARGE_CONST LV_ATTRIBUTE_IMG_ZMKLOGO uint8_t zmklogo_map[] = {
0xff, 0xff, 0xff, 0xff, /*Color of index 0*/
0x00, 0x00, 0x00, 0xfe, /*Color of index 1*/

0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xf0, 0x0e, 0x7e, 0x73, 0xc7,
0xe0, 0x04, 0x3c, 0x31, 0x87,
0xf0, 0x0c, 0x18, 0x31, 0x0f,
0xff, 0x0c, 0x18, 0x30, 0x1f,
0xff, 0x1c, 0x00, 0x30, 0x3f,
0xfe, 0x3c, 0x00, 0x30, 0x7f,
0xfe, 0x3c, 0x42, 0x30, 0xff,
0xfc, 0x7c, 0x66, 0x30, 0xff,
0xf8, 0x7c, 0x7e, 0x30, 0x7f,
0xf8, 0xfc, 0x7e, 0x30, 0x3f,
0xf0, 0xfc, 0x7e, 0x30, 0x1f,
0xf0, 0x0c, 0x7e, 0x31, 0x0f,
0xe0, 0x04, 0x7e, 0x31, 0x87,
0xf0, 0x0e, 0xff, 0x73, 0xc7,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff,
};

const lv_img_dsc_t zmklogo = {
.header.cf = LV_IMG_CF_INDEXED_1BIT,
.header.always_zero = 0,
.header.reserved = 0,
.header.w = 40,
.header.h = 40,
.data_size = 208,
.data = zmklogo_map,
};

0 comments on commit b74dffe

Please sign in to comment.