Ken Van Hoeylandt d860ba1f34
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
2026-02-15 19:45:12 +01:00

74 lines
1.4 KiB
C

// SPDX-License-Identifier: Apache-2.0
#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;
}
enum UiDensity lvgl_get_ui_density(void) {
return TT_LVGL_UI_DENSITY;
}
struct Module lvgl_module = {
.name = "lvgl",
.start = start,
.stop = stop,
.symbols = (const struct ModuleSymbol*)lvgl_module_symbols,
.internal = NULL
};