Ken Van Hoeylandt 9a11e6f47b
Implement UI scaling and more (#501)
**New Features**
 * Runtime font accessors and new symbol fonts for text, launcher, statusbar, and shared icons.
 * Added font height base setting to device.properties
 * Text fonts now have 3 sizes: small, default, large

**Improvements**
 * Renamed `UiScale` to `UiDensity`
 * Statusbar, toolbar and many UI components now compute heights and spacing from fonts/density.
 * SSD1306 initialization sequence refined for more stable startup.
 * Multiple image assets replaced by symbol-font rendering.
 * Many layout improvements related to density, font scaling and icon scaling
 * Updated folder name capitalization for newer style
2026-02-15 01:41:47 +01:00

70 lines
1.3 KiB
C

// SPDX-License-Identifier: GPL-3.0-only
#include <lvgl.h>
#include <string.h>
#include <tactility/module.h>
#include <tactility/lvgl_module.h>
extern const struct ModuleSymbol lvgl_module_symbols[];
error_t lvgl_arch_start();
error_t lvgl_arch_stop();
static bool is_running = false;
static bool is_configured = false;
struct LvglModuleConfig lvgl_module_config = {
NULL,
NULL,
0,
0,
#ifdef ESP_PLATFORM
0,
#endif
};
void lvgl_module_configure(const struct LvglModuleConfig config) {
is_configured = true;
memcpy(&lvgl_module_config, &config, sizeof(struct LvglModuleConfig));
}
static error_t start() {
if (!is_configured) {
return ERROR_INVALID_STATE;
}
if (is_running) {
return ERROR_NONE;
}
error_t result = lvgl_arch_start();
if (result == ERROR_NONE) {
is_running = true;
}
return result;
}
static error_t stop() {
if (!is_running) {
return ERROR_NONE;
}
error_t error = lvgl_arch_stop();
if (error == ERROR_NONE) {
is_running = false;
}
return error;
}
bool lvgl_is_running() {
return is_running;
}
struct Module lvgl_module = {
.name = "lvgl",
.start = start,
.stop = stop,
.symbols = (const struct ModuleSymbol*)lvgl_module_symbols,
.internal = NULL
};