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
@@ -14,6 +14,7 @@
|
||||
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/lvgl_fonts.h>
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
@@ -172,8 +173,8 @@ lv_obj_t* statusbar_create(lv_obj_t* parent) {
|
||||
lv_obj_set_flex_flow(obj, LV_FLEX_FLOW_ROW);
|
||||
lv_obj_set_flex_align(obj, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_CENTER);
|
||||
auto icon_size = lvgl_get_statusbar_icon_font_height();
|
||||
auto ui_density = hal::getConfiguration()->uiDensity;
|
||||
auto icon_padding = (ui_density != hal::UiDensity::Compact) ? static_cast<uint32_t>(icon_size * 0.2f) : 2;
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto icon_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? static_cast<uint32_t>(icon_size * 0.2f) : 2;
|
||||
lv_obj_set_style_pad_column(obj, icon_padding, LV_STATE_DEFAULT);
|
||||
|
||||
statusbar->time = lv_label_create(obj);
|
||||
|
||||
@@ -2,41 +2,43 @@
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
#include <Tactility/service/loader/Loader.h>
|
||||
|
||||
#include <tactility/check.h>
|
||||
#include <tactility/lvgl_fonts.h>
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
namespace tt::lvgl {
|
||||
|
||||
static uint32_t getToolbarHeight(hal::UiDensity uiDensity) {
|
||||
if (uiDensity == hal::UiDensity::Compact) {
|
||||
static uint32_t getToolbarHeight(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_DEFAULT) * 1.4f;
|
||||
} else {
|
||||
return lvgl_get_text_font_height(FONT_SIZE_LARGE) * 2.2f;
|
||||
}
|
||||
}
|
||||
|
||||
static const _lv_font_t* getToolbarFont(hal::UiDensity uiDensity) {
|
||||
if (uiDensity == hal::UiDensity::Compact) {
|
||||
static const _lv_font_t* getToolbarFont(UiDensity uiDensity) {
|
||||
if (uiDensity == LVGL_UI_DENSITY_COMPACT) {
|
||||
return lvgl_get_text_font(FONT_SIZE_DEFAULT);
|
||||
} else {
|
||||
return lvgl_get_text_font(FONT_SIZE_LARGE);
|
||||
}
|
||||
}
|
||||
|
||||
static uint32_t getActionIconPadding(hal::UiDensity ui_density) {
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
static uint32_t getActionIconPadding(UiDensity uiDensity) {
|
||||
auto toolbar_height = getToolbarHeight(uiDensity);
|
||||
// Minimal 8 pixels total padding for selection/animation (4+4 pixels)
|
||||
return (ui_density != hal::UiDensity::Compact) ? (uint32_t)(toolbar_height * 0.2f) : 8;
|
||||
return (uiDensity != LVGL_UI_DENSITY_COMPACT) ? (uint32_t)(toolbar_height * 0.2f) : 8;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helps with button expansion and also with vertical alignment of content,
|
||||
* as the parent flex doesn't allow for vertical alignment
|
||||
*/
|
||||
static lv_obj_t* create_action_wrapper(lv_obj_t* parent, hal::UiDensity ui_density) {
|
||||
static lv_obj_t* create_action_wrapper(lv_obj_t* parent, UiDensity ui_density) {
|
||||
auto* wrapper = lv_obj_create(parent);
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
lv_obj_set_size(wrapper, LV_SIZE_CONTENT, toolbar_height);
|
||||
@@ -89,7 +91,7 @@ static void toolbar_constructor(const lv_obj_class_t* class_p, lv_obj_t* obj) {
|
||||
}
|
||||
|
||||
lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title) {
|
||||
auto ui_density = hal::getConfiguration()->uiDensity;
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
toolbar_class.height_def = toolbar_height;
|
||||
lv_obj_t* obj = lv_obj_class_create_obj(&toolbar_class, parent);
|
||||
@@ -109,7 +111,7 @@ lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title) {
|
||||
auto* close_button_wrapper = create_action_wrapper(obj, ui_density);
|
||||
|
||||
toolbar->close_button = lv_button_create(close_button_wrapper);
|
||||
if (ui_density == hal::UiDensity::Compact) {
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(toolbar->close_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -121,8 +123,8 @@ lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title) {
|
||||
lv_obj_align(toolbar->close_button_image, LV_ALIGN_CENTER, 0, 0);
|
||||
|
||||
auto* title_wrapper = lv_obj_create(obj);
|
||||
uint32_t title_left_padding = (ui_density != hal::UiDensity::Compact) ? icon_padding : 2;
|
||||
uint32_t title_right_padding = (ui_density != hal::UiDensity::Compact) ? (icon_padding / 2) : 2;
|
||||
uint32_t title_left_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? icon_padding : 2;
|
||||
uint32_t title_right_padding = (ui_density != LVGL_UI_DENSITY_COMPACT) ? (icon_padding / 2) : 2;
|
||||
lv_obj_set_size(title_wrapper, LV_SIZE_CONTENT, LV_PCT(100));
|
||||
lv_obj_set_style_bg_opa(title_wrapper, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_left(title_wrapper, title_left_padding, LV_STATE_DEFAULT);
|
||||
@@ -179,7 +181,7 @@ lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* imageOrButton, bo
|
||||
check(toolbar->action_count < TOOLBAR_ACTION_LIMIT, "max actions reached");
|
||||
toolbar->action_count++;
|
||||
|
||||
auto ui_density = hal::getConfiguration()->uiDensity;
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto toolbar_height = getToolbarHeight(ui_density);
|
||||
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
@@ -190,7 +192,7 @@ lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* imageOrButton, bo
|
||||
lv_obj_set_size(action_button, toolbar_height - padding, toolbar_height - padding);
|
||||
lv_obj_set_style_pad_all(action_button, 0, LV_STATE_DEFAULT);
|
||||
lv_obj_align(action_button, LV_ALIGN_CENTER, 0, 0);
|
||||
if (ui_density == hal::UiDensity::Compact) {
|
||||
if (ui_density == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_bg_opa(action_button, LV_OPA_TRANSP, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -219,7 +221,7 @@ lv_obj_t* toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_eve
|
||||
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
|
||||
auto ui_density = hal::getConfiguration()->uiDensity;
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
lv_obj_set_style_pad_hor(wrapper, 4, LV_STATE_DEFAULT);
|
||||
|
||||
@@ -231,7 +233,7 @@ lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
auto* toolbar = reinterpret_cast<Toolbar*>(obj);
|
||||
|
||||
auto ui_density = hal::getConfiguration()->uiDensity;
|
||||
auto ui_density = lvgl_get_ui_density();
|
||||
auto* wrapper = create_action_wrapper(toolbar->action_container, ui_density);
|
||||
|
||||
auto* spinner = spinner_create(wrapper);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern lv_obj_t* __real_lv_button_create(lv_obj_t* parent);
|
||||
@@ -11,7 +11,7 @@ extern lv_obj_t* __real_lv_button_create(lv_obj_t* parent);
|
||||
lv_obj_t* __wrap_lv_button_create(lv_obj_t* parent) {
|
||||
auto button = __real_lv_button_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_all(button, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_radius(button, 3, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern lv_obj_t* __real_lv_dropdown_create(lv_obj_t* parent);
|
||||
@@ -11,7 +11,7 @@ extern lv_obj_t* __real_lv_dropdown_create(lv_obj_t* parent);
|
||||
lv_obj_t* __wrap_lv_dropdown_create(lv_obj_t* parent) {
|
||||
auto dropdown = __real_lv_dropdown_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_all(dropdown, 2, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern lv_obj_t* __real_lv_list_create(lv_obj_t* parent);
|
||||
@@ -12,7 +12,7 @@ extern lv_obj_t* __real_lv_list_add_button(lv_obj_t* list, const void* icon, con
|
||||
lv_obj_t* __wrap_lv_list_create(lv_obj_t* parent) {
|
||||
auto* list = __real_lv_list_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_row(list, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_column(list, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_all(list, 2, LV_STATE_DEFAULT);
|
||||
@@ -24,7 +24,7 @@ lv_obj_t* __wrap_lv_list_create(lv_obj_t* parent) {
|
||||
lv_obj_t* __wrap_lv_list_add_button(lv_obj_t* list, const void* icon, const char* txt) {
|
||||
auto* button = __real_lv_list_add_button(list, icon, txt);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_ver(button, 2, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern void __real_lv_obj_set_flex_flow(lv_obj_t* obj, lv_flex_flow_t flow);
|
||||
@@ -12,14 +12,14 @@ extern lv_obj_t* __real_lv_obj_create(lv_obj_t* parent);
|
||||
void __wrap_lv_obj_set_flex_flow(lv_obj_t* obj, lv_flex_flow_t flow) {
|
||||
__real_lv_obj_set_flex_flow(obj, flow);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_gap(obj, 4, LV_STATE_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
lv_obj_t* __wrap_lv_obj_create(lv_obj_t* parent) {
|
||||
auto obj = __real_lv_obj_create(parent);
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_all(obj, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_pad_gap(obj, 2, LV_STATE_DEFAULT);
|
||||
lv_obj_set_style_radius(obj, 3, LV_STATE_DEFAULT);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern lv_obj_t* __real_lv_switch_create(lv_obj_t* parent);
|
||||
@@ -11,7 +11,7 @@ extern lv_obj_t* __real_lv_switch_create(lv_obj_t* parent);
|
||||
lv_obj_t* __wrap_lv_switch_create(lv_obj_t* parent) {
|
||||
auto widget = __real_lv_switch_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_size(widget, 25, 15, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
#ifdef ESP_PLATFORM
|
||||
|
||||
#include <Tactility/app/App.h>
|
||||
#include <lvgl.h>
|
||||
|
||||
#include <tactility/lvgl_module.h>
|
||||
|
||||
#include <Tactility/service/gui/GuiService.h>
|
||||
#include <Tactility/Tactility.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
@@ -11,7 +13,7 @@ extern lv_obj_t* __real_lv_textarea_create(lv_obj_t* parent);
|
||||
lv_obj_t* __wrap_lv_textarea_create(lv_obj_t* parent) {
|
||||
auto textarea = __real_lv_textarea_create(parent);
|
||||
|
||||
if (tt::hal::getConfiguration()->uiDensity == tt::hal::UiDensity::Compact) {
|
||||
if (lvgl_get_ui_density() == LVGL_UI_DENSITY_COMPACT) {
|
||||
lv_obj_set_style_pad_all(textarea, 2, LV_STATE_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user