Compare commits

...

12 Commits

Author SHA1 Message Date
Ken Van Hoeylandt
c5a8c99597 Fix for file overwrite 2026-08-09 00:09:44 +02:00
Ken Van Hoeylandt
884a008333 Fix Setup 2026-08-09 00:06:06 +02:00
Ken Van Hoeylandt
e618086590 Cleanup 2026-08-09 00:00:26 +02:00
Ken Van Hoeylandt
24860be671 Cleanup 2026-08-09 00:00:16 +02:00
Ken Van Hoeylandt
9c54ac4944 Fix for keyboard 2026-08-08 23:46:52 +02:00
Ken Van Hoeylandt
6b68e9f194 Update integration app 2026-08-08 23:25:17 +02:00
Ken Van Hoeylandt
52f90ae6a6 Fix 2026-08-08 23:12:45 +02:00
Ken Van Hoeylandt
e02766c1a4 Fix for syntax 2026-08-08 23:04:58 +02:00
Ken Van Hoeylandt
3c783c1fb4 Fixes 2026-08-08 22:58:27 +02:00
Ken Van Hoeylandt
22192dd1e4 Fix for macOS build 2026-08-08 22:51:40 +02:00
Ken Van Hoeylandt
68aae6520d Fix for SDK test 2026-08-08 22:49:53 +02:00
Ken Van Hoeylandt
26a8aa26c2 Fixes and cleanup 2026-08-08 22:41:52 +02:00
36 changed files with 145 additions and 179 deletions

View File

@ -7,7 +7,6 @@ idf_component_register(
"Libraries/minmea/include"
"Libraries/minitar/include"
"Modules/lvgl-module/include"
# DRIVER_INCLUDE_DIRS_PLACEHOLDER
REQUIRES esp_timer app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
)

View File

@ -20,7 +20,6 @@ macro(tactility_project project_name)
set(EXTRA_COMPONENT_DIRS
"${TACTILITY_SDK_PATH}/Libraries/TactilityFreeRtos"
"${TACTILITY_SDK_PATH}/Modules"
"${TACTILITY_SDK_PATH}/Drivers"
)
set(COMPONENTS
@ -31,7 +30,6 @@ macro(tactility_project project_name)
lvgl-module
lvgl-window-manager-module
service-module
# DRIVER_COMPONENTS_PLACEHOLDER
)
endmacro()

View File

@ -111,43 +111,13 @@ def add_module(target_path, module_name):
cmakelists_content = create_module_cmakelists(module_name)
write_module_cmakelists(os.path.join(target_path, f"Modules/{module_name}/CMakeLists.txt"), cmakelists_content)
def discover_all_drivers():
"""
Discover all *-module directories under Drivers/ (not Modules/ - those are handled
separately via add_module). Sorted for deterministic output across OS/filesystem order.
"""
pattern = os.path.join('Drivers', '*-module')
return sorted(
os.path.basename(p) for p in glob.glob(pattern) if os.path.isdir(p)
)
def generate_tactility_sdk_cmake(target_path, available_drivers):
def generate_tactility_sdk_cmake(target_path):
src = os.path.join('Buildscripts', 'TactilitySDK', 'TactilitySDK.cmake')
with open(src) as f:
content = f.read()
placeholder = " # DRIVER_COMPONENTS_PLACEHOLDER"
assert placeholder in content, \
f"Placeholder '{placeholder.strip()}' not found in {src} - template drifted, generator needs updating"
components = "\n".join(f" {d}" for d in available_drivers)
new_content = content.replace(placeholder, components)
assert placeholder not in new_content, \
f"Placeholder '{placeholder.strip()}' still present after replacement in {src}"
with open(os.path.join(target_path, 'TactilitySDK.cmake'), 'w') as f:
f.write(new_content)
shutil.copy2(src, os.path.join(target_path, 'TactilitySDK.cmake'))
def generate_tactility_sdk_top_cmakelists(target_path, available_drivers):
def generate_tactility_sdk_top_cmakelists(target_path):
src = os.path.join('Buildscripts', 'TactilitySDK', 'CMakeLists.txt')
with open(src) as f:
content = f.read()
placeholder = " # DRIVER_INCLUDE_DIRS_PLACEHOLDER"
assert placeholder in content, \
f"Placeholder '{placeholder.strip()}' not found in {src} - template drifted, generator needs updating"
include_dirs = "\n".join(f' "Drivers/{d}/include"' for d in available_drivers)
new_content = content.replace(placeholder, include_dirs)
assert placeholder not in new_content, \
f"Placeholder '{placeholder.strip()}' still present after replacement in {src}"
with open(os.path.join(target_path, 'CMakeLists.txt'), 'w') as f:
f.write(new_content)
shutil.copy2(src, os.path.join(target_path, 'CMakeLists.txt'))
def main():
if len(sys.argv) < 2:
@ -208,16 +178,9 @@ def main():
add_module(target_path, "lvgl-window-manager-module")
add_module(target_path, "service-module")
# Drivers - only ones actually built for this target (chip-restricted drivers like
# sc2356-module won't have a .a outside ESP32-P4)
available_drivers = [d for d in discover_all_drivers() if driver_is_available(d)]
for driver_name in available_drivers:
add_driver(target_path, driver_name)
# Final scripts - generated (not copied verbatim) so COMPONENTS/INCLUDE_DIRS only list
# drivers actually available for this target
generate_tactility_sdk_cmake(target_path, available_drivers)
generate_tactility_sdk_top_cmakelists(target_path, available_drivers)
# Final scripts - copied verbatim
generate_tactility_sdk_cmake(target_path)
generate_tactility_sdk_top_cmakelists(target_path)
# Output ESP-IDF SDK version to file
esp_idf_version = os.environ.get("ESP_IDF_VERSION", "")

View File

@ -12,6 +12,8 @@
## Higher Priority
- Devices with a keyboard attached should always highlight the first widget (~Cardputer navigation issue), same for LV_INDEV_TYPE_ENCODER being present
- Make it more clear to end-users that an SD card is required to run Tactility
- Move "# Fix error "PSRAM space not enough for the Flash instructions" on boot:" fix from T-Deck and others to device.py
- Make it possible to override stack size for an app via config file (loaded at boot), and make it possible to set preferred memory location (e.g. internal/external)
- Put task stacks in PSRAM when possible.
@ -52,6 +54,7 @@
## Medium Priority
- Consider moving certain drivers into separate modules: audio, bt, wifi, etc
- Consider using https://github.com/Graphify-Labs/graphify
- Consider implementing LVGL gridnav in apps https://lvgl.io/docs/open/9.3/details/auxiliary-modules/gridnav.html
- Implement a LED kernel driver (single colour and RGB, plain GPIO and PWM)

View File

@ -50,11 +50,10 @@ void lvgl_keyboard_enable(lv_indev_t* indev);
void lvgl_keyboard_disable(lv_indev_t* indev);
/**
* @brief Wires a textarea up to the on-screen keyboard: shows it on focus, hides it on
* defocus/ready, and adds the textarea to the keyboard's navigation group.
*
* No-op if lvgl_software_keyboard_is_enabled() is false (i.e. a hardware keyboard is present).
*
* @brief Adds the textarea to the shared keyboard navigation group (so any keypad indev -
* hardware or on-screen - can type into it once it's focused), and, only when
* lvgl_software_keyboard_is_enabled() is true (i.e. no hardware keyboard is present), wires it
* up to show/hide the on-screen keyboard on focus/defocus/ready.
* @warning Caller must hold the LVGL lock.
* @param[in] keyboard the on-screen keyboard to associate with the textarea
* @param[in] textarea the lv_textarea_t object to wire up

View File

@ -177,16 +177,22 @@ LvglSoftwareKeyboard* lvgl_software_keyboard_get_last() {
}
void lvgl_keyboard_add_textarea(LvglSoftwareKeyboard* keyboard, lv_obj_t* textarea) {
// Only the on-screen keyboard's show/hide wiring is specific to "no hardware keyboard"
// mode. Group membership must NOT be gated on it: a hardware keypad indev (see
// lvgl_keyboard_enable()/lvgl_software_keyboard_activate()) is bound to keyboard_group
// regardless of whether a software keyboard is in use, so skipping lv_group_add_obj()
// here left every textarea unreachable from a hardware keyboard - it was never a member
// of the group its indev delivers key events through.
if (lvgl_software_keyboard_is_enabled()) {
lv_obj_add_event_cb(textarea, textarea_show_keyboard, LV_EVENT_FOCUSED, nullptr);
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_DEFOCUSED, nullptr);
lv_obj_add_event_cb(textarea, textarea_hide_keyboard, LV_EVENT_READY, nullptr);
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
lv_group_add_obj(keyboard_group, textarea);
lvgl_software_keyboard_activate(keyboard);
}
// lv_obj_t auto-remove themselves from the group when they are destroyed (last checked in LVGL 8.3)
lv_group_add_obj(keyboard_group, textarea);
lvgl_software_keyboard_activate(keyboard);
}
void lvgl_software_keyboard_activate(LvglSoftwareKeyboard* keyboard) {

View File

@ -1,14 +1,12 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "../../../app-module/include/app/instance.h"
#include <app/instance.h>
#include <lvgl.h>
#include <tactility/error.h>
#include <tactility/freertos/freertos.h>
#include <tactility/freertos/task.h>
#include <stdint.h>

View File

@ -1,10 +1,12 @@
/**
* DEPRECATED: Use TactilityKernels' tactility/paths.h
*/
#pragma once
#include <string>
#include <tactility/filesystem/file_system.h>
namespace tt {
bool findFirstMountedSdCardPath(std::string& path);

View File

@ -1,4 +1,4 @@
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include "../../Modules/app-module/private/app/private/app_metadata_parsing_internal.h"

View File

@ -18,9 +18,9 @@
#include <Tactility/Tactility.h>
#include <Tactility/CpuAffinity.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/LogMessages.h>
#include <Tactility/MountPoints.h>
#include <Tactility/Paths.h>
#include <Tactility/TactilityConfig.h>
#include <Tactility/bluetooth/Bluetooth.h>
#include <Tactility/file/File.h>

View File

@ -1,5 +1,5 @@
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/Mutex.h>
#include <Tactility/Paths.h>
#include <Tactility/app/apphub/AppHub.h>
#include <Tactility/app/apphub/AppHubEntry.h>
#include <Tactility/app/apphubdetails/AppHubDetailsApp.h>

View File

@ -2,7 +2,7 @@
#include "app/metadata.h"
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/StringUtils.h>
#include <Tactility/app/alertdialog/AlertDialog.h>
#include <Tactility/app/apphub/AppHub.h>

View File

@ -12,8 +12,8 @@
#include <lvgl_window_manager/window_manager.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/MountPoints.h>
#include <Tactility/Paths.h>
#include <Tactility/TactilityPrivate.h>
#include <Tactility/hal/usb/Usb.h>
#include <Tactility/lvgl/Lvgl.h>
@ -68,34 +68,39 @@ std::string getBootAssetsPath(const std::string& childPath) {
}
void setupDisplay() {
// TODO: Support for multiple displays
Device* display = nullptr;
if (device_get_first_by_type(&DISPLAY_TYPE, &display) == ERROR_NONE) {
Device* backlight;
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
if (!device_is_ready(backlight)) {
if (device_start(backlight) != ERROR_NONE) {
LOG_E(TAG, "Failed to start %s", backlight->name);
}
}
settings::display::DisplaySettings settings;
if (settings::display::load(settings)) {
} else {
settings = settings::display::getDefault();
}
if (backlight_set_brightness(backlight, settings.backlightDuty) == ERROR_NONE) {
LOG_I(TAG, "Backlight for %s set to %d", display->name, settings.backlightDuty);
} else {
LOG_E(TAG, "Failed to set brightness of %s", backlight->name);
}
} else {
LOG_I(TAG, "No backlight for %s", display->name);
}
device_put(display);
} else {
if (device_get_first_by_type(&DISPLAY_TYPE, &display) != ERROR_NONE) {
LOG_I(TAG, "No kernel display");
return;
}
// Set backlight brightness
Device* backlight;
if (display_get_backlight(display, &backlight) == ERROR_NONE) {
if (!device_is_ready(backlight)) {
if (device_start(backlight) != ERROR_NONE) {
LOG_E(TAG, "Failed to start %s", backlight->name);
}
}
settings::display::DisplaySettings settings;
if (settings::display::load(settings)) {
} else {
settings = settings::display::getDefault();
}
if (backlight_set_brightness(backlight, settings.backlightDuty) == ERROR_NONE) {
LOG_I(TAG, "Backlight for %s set to %d", display->name, settings.backlightDuty);
} else {
LOG_E(TAG, "Failed to set brightness of %s", backlight->name);
}
} else {
LOG_I(TAG, "No backlight for %s", display->name);
}
device_put(display);
}
bool setupUsbBootMode() {
@ -253,7 +258,6 @@ void runBootSequence(TickType_t startTime) {
// This works with 5 ms on a T-Lora Pager, so we give it 10 ms to be safe
delay_millis(10);
// TODO: Support for multiple displays
LOG_I(TAG, "Setup display");
setupDisplay();
LOG_I(TAG, "Prepare file systems");

View File

@ -7,9 +7,9 @@
#include <Tactility/app/chat/ChatSettings.h>
#include <Tactility/app/chat/ChatProtocol.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <crypt/crypt.h>

View File

@ -6,7 +6,7 @@
#include <Tactility/Platform.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/service/screenshot/Screenshot.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/Timer.h>
#include <app/event.h>

View File

@ -1,7 +1,9 @@
#include <Tactility/app/setup/Setup.h>
#include <Tactility/StringUtils.h>
#include <Tactility/app/timezone/TimeZone.h>
#include <Tactility/app/wifimanage/WifiManage.h>
#include <Tactility/file/File.h>
#include <Tactility/service/wifi/Wifi.h>
#include <app/event.h>
@ -10,8 +12,8 @@
#include <lvgl_window_manager/window_manager.h>
#include <tactility/log.h>
#include <tactility/paths.h>
#include <tactility/preferences.h>
#include <lvgl/fonts.h>
#include <lvgl/lvgl.h>
@ -32,17 +34,16 @@ namespace tt::app::setup {
extern const ::AppManifest manifest;
constexpr auto* PREFERENCES_NAMESPACE = "setup";
constexpr auto* PREFERENCES_KEY_COMPLETED = "completed";
constexpr auto* TAG = "setup";
namespace {
bool getPreferencesPath(std::string& outPath) {
bool getCompletedMarkerPath(std::string& outPath) {
char root[128];
if (paths_get_user_data_path(root, sizeof(root)) != ERROR_NONE) {
return false;
}
outPath = std::string(root) + "/" + PREFERENCES_NAMESPACE + ".properties";
outPath = std::string(root) + "/.setup_complete";
return true;
}
@ -50,32 +51,23 @@ bool getPreferencesPath(std::string& outPath) {
bool isCompleted() {
std::string path;
if (!getPreferencesPath(path)) {
if (!getCompletedMarkerPath(path)) {
LOG_E(TAG, "Setup path not found");
return false;
}
Preferences* preferences = preferences_open(path.c_str());
if (preferences == nullptr) {
return false;
}
bool completed = false;
preferences_opt_bool(preferences, PREFERENCES_KEY_COMPLETED, &completed);
preferences_close(preferences);
return completed;
file::FileMutexGuard guard(path);
return file::isFile(path);
}
namespace {
void markCompleted() {
std::string path;
if (!getPreferencesPath(path)) {
if (!getCompletedMarkerPath(path)) {
return;
}
Preferences* preferences = preferences_open(path.c_str());
if (preferences == nullptr) {
return;
}
preferences_put_bool(preferences, PREFERENCES_KEY_COMPLETED, true);
preferences_close(preferences);
file::FileMutexGuard guard(path);
file::writeString(path, "");
}
enum class Phase {

View File

@ -1,6 +1,6 @@
#include "tactility/time.h"
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/Tactility.h>
#include <Tactility/TactilityConfig.h>
#include <Tactility/Timer.h>

View File

@ -1,6 +1,6 @@
#include <Tactility/bluetooth/BluetoothPairedDevice.h>
#include "Tactility/Paths.h"
#include "Tactility/DeprecatedPaths.h"
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>

View File

@ -1,9 +1,9 @@
#include <Tactility/bluetooth/BluetoothSettings.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/Mutex.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Mutex.h>
#include <Tactility/Paths.h>
#include <tactility/log.h>
namespace tt::bluetooth::settings {

View File

@ -5,14 +5,14 @@
#include <tactility/log.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/StringUtils.h>
#include <Tactility/file/File.h>
#include <Tactility/network/HttpdReq.h>
#include <Tactility/network/Url.h>
#include <Tactility/service/ServiceRegistration.h>
#include <Tactility/service/development/DevelopmentSettings.h>
#include <Tactility/service/development/DevelopmentService.h>
#include <Tactility/service/development/DevelopmentSettings.h>
#include <ranges>
#include <sstream>

View File

@ -1,7 +1,7 @@
#ifdef ESP_PLATFORM
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <Tactility/service/development/DevelopmentSettings.h>
#include <map>
#include <string>

View File

@ -8,13 +8,13 @@
#include <Tactility/lvgl/Statusbar.h>
#include <Tactility/Mutex.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/StringUtils.h>
#include <Tactility/TactilityConfig.h>
#include <Tactility/service/wifi/Wifi.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/network/HttpdReq.h>
#include <Tactility/network/Url.h>
#include <Tactility/Paths.h>
#include <Tactility/lvgl/Lvgl.h>
#include <Tactility/StringUtils.h>
#include <Tactility/service/wifi/Wifi.h>
#include <tactility/check.h>
#include <tactility/filesystem/file_system.h>

View File

@ -9,7 +9,7 @@
#include <Tactility/file/File.h>
#include <Tactility/service/wifi/WifiApSettings.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/Tactility.h>
#include <tactility/log.h>

View File

@ -1,8 +1,8 @@
#include <Tactility/settings/AudioSettings.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <algorithm>
#include <cstdio>

View File

@ -3,7 +3,7 @@
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/settings/BootSettings.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <format>
#include <string>

View File

@ -2,7 +2,7 @@
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <map>
#include <string>

View File

@ -1,7 +1,7 @@
#include <Tactility/settings/KeyboardSettings.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <map>
#include <string>

View File

@ -5,7 +5,7 @@
#include <Tactility/settings/Language.h>
#include <Tactility/settings/SystemSettings.h>
#include "Tactility/Paths.h"
#include "Tactility/DeprecatedPaths.h"
#include <tactility/log.h>

View File

@ -2,7 +2,7 @@
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <cstdlib>
#include <cerrno>

View File

@ -1,7 +1,7 @@
#include <Tactility/settings/TrackballSettings.h>
#include <Tactility/file/File.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/Paths.h>
#include <Tactility/DeprecatedPaths.h>
#include <map>
#include <string>

View File

@ -1,7 +1,7 @@
#include <Tactility/settings/WebServerSettings.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/DeprecatedPaths.h>
#include <Tactility/file/File.h>
#include <Tactility/Paths.h>
#include <Tactility/file/PropertiesFile.h>
#include <Tactility/settings/WebServerSettings.h>
#include <tactility/log.h>

View File

@ -1,7 +1,9 @@
// SPDX-License-Identifier: Apache-2.0
#include <tactility/preferences.h>
#include <tactility/properties_file.h>
#include <tactility/log.h>
#include <tactility/paths.h>
#include <tactility/properties_file.h>
#include <cerrno>
#include <cinttypes>
@ -15,6 +17,8 @@
namespace {
constexpr auto* TAG = "preferences";
// Escapes '\\' and '\n' so a string value can never break properties_file's one-entry-per-line
// on-disk format, regardless of its content.
std::string escape(const std::string& value) {
@ -176,16 +180,19 @@ extern "C" {
Preferences* preferences_open(const char* path) {
std::string directory = parent_directory(path);
if (!directory.empty() && !ensure_directory_recursive(directory)) {
LOG_E(TAG, "Directory not found: %s", directory.c_str());
return nullptr;
}
PropertiesFile* file = properties_file_open(path);
if (file == nullptr) {
LOG_E(TAG, "Failed to open %s", path);
return nullptr;
}
auto* preferences = new (std::nothrow) Preferences { file };
if (preferences == nullptr) {
LOG_E(TAG, "Out of memory");
properties_file_close(file);
return nullptr;
}

View File

@ -150,6 +150,10 @@ bool save_to_file(const PropertiesFile* file) {
return false;
}
// rename() may not overwrite an existing destination on some filesystems (e.g. FAT on
// ESP32), so remove it first; this is best-effort and ignored if the path doesn't exist yet.
std::remove(file->path.c_str());
if (std::rename(temp_path.c_str(), file->path.c_str()) != 0) {
LOG_E(TAG, "Failed to replace %s", file->path.c_str());
std::remove(temp_path.c_str());

View File

@ -10,7 +10,7 @@ else()
endif()
include("${TACTILITY_SDK_PATH}/TactilitySDK.cmake")
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules ${TACTILITY_SDK_PATH}/Drivers)
set(EXTRA_COMPONENT_DIRS ${TACTILITY_SDK_PATH} ${TACTILITY_SDK_PATH}/Modules)
project(SdkTest)
tactility_project(SdkTest)

View File

@ -3,11 +3,5 @@ file(GLOB_RECURSE SOURCE_FILES Source/*.c)
idf_component_register(
SRCS ${SOURCE_FILES}
REQUIRES TactilitySDK
lvgl-module
bm8563-module
bmi270-module
mpu6886-module
pi4ioe5v6408-module
qmi8658-module
rx8130ce-module
app-module crypt-module gps-module lvgl-module lvgl-window-manager-module service-module
)

View File

@ -1,37 +1,15 @@
#include <tt_app.h>
#include <app/event.h>
#include <app/manager.h>
#include <app/scheduler.h>
#include <lvgl/lvgl.h>
#include <lvgl_window_manager/window_manager.h>
#include <lvgl.h>
#include <lvgl/widgets/toolbar.h>
#include <tactility/concurrent/dispatcher.h>
#include <tactility/concurrent/event_group.h>
#include <tactility/concurrent/mutex.h>
#include <tactility/concurrent/recursive_mutex.h>
#include <tactility/concurrent/thread.h>
#include <tactility/concurrent/timer.h>
#include <tactility/drivers/gpio.h>
#include <tactility/drivers/gpio_controller.h>
#include <tactility/drivers/i2c_controller.h>
#include <tactility/drivers/i2s_controller.h>
#include <tactility/drivers/root.h>
#include <tactility/check.h>
#include <tactility/defines.h>
#include <tactility/delay.h>
#include <tactility/device.h>
#include <tactility/driver.h>
#include <tactility/error.h>
#include <tactility/log.h>
#include <tactility/module.h>
#include <tactility/time.h>
#include <stdbool.h>
#include <drivers/bm8563.h>
#include <drivers/bmi270.h>
#include <drivers/mpu6886.h>
#include <drivers/pi4ioe5v6408.h>
#include <drivers/qmi8658.h>
#include <drivers/rx8130ce.h>
static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
static void create_widgets(lv_obj_t* parent, void* userData) {
lv_obj_t* toolbar = lvgl_toolbar_create(parent, "Title");
lv_obj_align(toolbar, LV_ALIGN_TOP_MID, 0, 0);
@ -41,8 +19,27 @@ static void onShowApp(AppHandle app, void* data, lv_obj_t* parent) {
}
int main(int argc, char* argv[]) {
tt_app_register((AppRegistration) {
.onShow = onShowApp
});
AppInstanceId app_instance_id = app_scheduler_current_app_id();
struct AppEventSubscription sub = { .app_instance_id = app_instance_id };
app_event_subscribe(&sub);
WindowId window = window_manager_create(app_instance_id, create_widgets, NULL);
bool should_close = false;
while (!should_close) {
struct AppEvent event;
if (app_event_await(&sub, &event, portMAX_DELAY) != ERROR_NONE) {
break;
}
if (event.type == APP_EVENT_CLOSE) {
app_manager_finish(app_instance_id);
should_close = true;
}
}
window_manager_remove(window);
app_event_unsubscribe(&sub);
return 0;
}