Tab5 audio, I2C improvements, UiDensity moved to lvgl-module and cleanup (#506)
- UiDensity moved to lvgl-module - Deleted tt_hal and tt_hal_gpio (breaks apps, but will fix those right after merging) - Added I2C 8 bit register operations - Added device.properties to simulator - Improved Tab5 hardware init, implement audio - Add README.md to kernel
This commit is contained in:
committed by
GitHub
parent
3a24d058c9
commit
d860ba1f34
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
# ####################################
|
||||
# Read properties
|
||||
# Read sdkconfig properties
|
||||
# ####################################
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/../../Buildscripts/properties.cmake")
|
||||
@@ -33,6 +33,34 @@ message(" - statusbar: ${statusbar_symbol_size}")
|
||||
message(" - launcher: ${launcher_symbol_size}")
|
||||
message(" - shared: ${shared_symbol_size}")
|
||||
|
||||
# ####################################
|
||||
# Read device properties
|
||||
# ####################################
|
||||
|
||||
# Load device.properties as a map
|
||||
get_property(TACTILITY_DEVICE_ID GLOBAL PROPERTY TACTILITY_DEVICE_ID)
|
||||
READ_PROPERTIES_TO_MAP(
|
||||
"${CMAKE_CURRENT_LIST_DIR}/../../Devices/${TACTILITY_DEVICE_ID}/device.properties"
|
||||
device_properties
|
||||
)
|
||||
# Read UI density
|
||||
GET_VALUE_FROM_MAP(device_properties "[lvgl]uiDensity" ui_density)
|
||||
# Define UiDensity enum value
|
||||
if (ui_density)
|
||||
if (ui_density STREQUAL "default")
|
||||
set(ui_density_variable "LVGL_UI_DENSITY_DEFAULT")
|
||||
elseif (ui_density STREQUAL "compact")
|
||||
set(ui_density_variable "LVGL_UI_DENSITY_COMPACT")
|
||||
else ()
|
||||
message(FATAL_ERROR "Invalid [lvgl]uiDensity: '${ui_density}'. Must be either 'default' or 'compact'")
|
||||
endif ()
|
||||
message("UI density set to '${ui_density}' via properties")
|
||||
else ()
|
||||
set(ui_density "default")
|
||||
set(ui_density_variable "LVGL_UI_DENSITY_DEFAULT")
|
||||
message("UI density set to default: ${ui_density}")
|
||||
endif ()
|
||||
|
||||
# ####################################
|
||||
# Create module
|
||||
# ####################################
|
||||
@@ -66,17 +94,22 @@ tactility_add_module(lvgl-module
|
||||
tactility_get_module_name("lvgl-module" MODULE_NAME)
|
||||
|
||||
target_compile_definitions(${MODULE_NAME} PUBLIC
|
||||
# Ensure it loads <lvgl.h>
|
||||
"-DLV_LVGL_H_INCLUDE_SIMPLE"
|
||||
# Text fonts
|
||||
"-DTT_LVGL_TEXT_FONT_SMALL_SIZE=${font_size_small}"
|
||||
"-DTT_LVGL_TEXT_FONT_SMALL_SYMBOL=lv_font_montserrat_${font_size_small}"
|
||||
"-DTT_LVGL_TEXT_FONT_DEFAULT_SIZE=${font_size_default}"
|
||||
"-DTT_LVGL_TEXT_FONT_DEFAULT_SYMBOL=lv_font_montserrat_${font_size_default}"
|
||||
"-DTT_LVGL_TEXT_FONT_LARGE_SIZE=${font_size_large}"
|
||||
"-DTT_LVGL_TEXT_FONT_LARGE_SYMBOL=lv_font_montserrat_${font_size_large}"
|
||||
# Icon fonts
|
||||
"-DTT_LVGL_STATUSBAR_FONT_ICON_SIZE=${statusbar_symbol_size}"
|
||||
"-DTT_LVGL_STATUSBAR_FONT_ICON_SYMBOL=material_symbols_statusbar_${statusbar_symbol_size}"
|
||||
"-DTT_LVGL_LAUNCHER_FONT_ICON_SIZE=${launcher_symbol_size}"
|
||||
"-DTT_LVGL_LAUNCHER_FONT_ICON_SYMBOL=material_symbols_launcher_${launcher_symbol_size}"
|
||||
"-DTT_LVGL_SHARED_FONT_ICON_SIZE=${shared_symbol_size}"
|
||||
"-DTT_LVGL_SHARED_FONT_ICON_SYMBOL=material_symbols_shared_${shared_symbol_size}"
|
||||
# UiDensity
|
||||
"-DTT_LVGL_UI_DENSITY=${ui_density_variable}"
|
||||
)
|
||||
|
||||
@@ -16,6 +16,14 @@ extern "C" {
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
/** Affects LVGL widget style */
|
||||
enum UiDensity {
|
||||
/** Ideal for very small non-touch screen devices (e.g. Waveshare S3 LCD 1.3") */
|
||||
LVGL_UI_DENSITY_COMPACT,
|
||||
/** Nothing was changed in the LVGL UI/UX */
|
||||
LVGL_UI_DENSITY_DEFAULT
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief The LVGL module instance.
|
||||
*/
|
||||
@@ -86,6 +94,14 @@ void lvgl_unlock(void);
|
||||
*/
|
||||
bool lvgl_is_running(void);
|
||||
|
||||
/**
|
||||
* @brief Gets the desired UI density for the target hardware.
|
||||
* The density is defined in the `device.properties` of a hardware device.
|
||||
* This setting is read by CMakeLists.txt and passed as a target compile definition of the LVGL module.
|
||||
* @return the UI density
|
||||
*/
|
||||
enum UiDensity lvgl_get_ui_density(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include "tactility/lvgl_module.h"
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern struct LvglModuleConfig lvgl_module_config;
|
||||
|
||||
|
||||
@@ -60,6 +60,10 @@ bool lvgl_is_running() {
|
||||
return is_running;
|
||||
}
|
||||
|
||||
enum UiDensity lvgl_get_ui_density(void) {
|
||||
return TT_LVGL_UI_DENSITY;
|
||||
}
|
||||
|
||||
struct Module lvgl_module = {
|
||||
.name = "lvgl",
|
||||
.start = start,
|
||||
|
||||
@@ -11,6 +11,7 @@ const struct ModuleSymbol lvgl_module_symbols[] = {
|
||||
DEFINE_MODULE_SYMBOL(lvgl_try_lock),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_unlock),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_is_running),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_ui_density),
|
||||
// lvgl_fonts
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_shared_icon_font),
|
||||
DEFINE_MODULE_SYMBOL(lvgl_get_shared_icon_font_height),
|
||||
|
||||
Reference in New Issue
Block a user