Project restructuring (fixes macOS builds) (#198)

- Create `Include/` folder for all main projects
- Fix some issues here and there (found while moving things)
- All includes are now in `Tactility/` subfolder and must be included with that prefix. This fixes issues with clashing POSIX headers (e.g. `<semaphore.h>` versus Tactility's `Semaphore.h`)
This commit is contained in:
Ken Van Hoeylandt
2025-02-01 18:13:20 +01:00
committed by GitHub
parent 7856827ecf
commit c87200a80d
350 changed files with 967 additions and 870 deletions
+10 -9
View File
@@ -1,12 +1,13 @@
#include "app/display/DisplaySettings.h"
#include "lvgl.h"
#include "hal/Configuration.h"
#include "hal/Display.h"
#include "hal/Touch.h"
#include "hal/Keyboard.h"
#include "lvgl/LvglKeypad.h"
#include "lvgl/LvglDisplay.h"
#include "kernel/SystemEvents.h"
#include "Tactility/app/display/DisplaySettings.h"
#include "Tactility/lvgl/LvglKeypad.h"
#include "Tactility/lvgl/LvglDisplay.h"
#include <Tactility/hal/Configuration.h>
#include <Tactility/hal/Keyboard.h>
#include <Tactility/hal/Touch.h>
#include <Tactility/kernel/SystemEvents.h>
#include <lvgl.h>
namespace tt::lvgl {
+2 -2
View File
@@ -1,5 +1,5 @@
#include "LabelUtils.h"
#include "file/File.h"
#include <Tactility/lvgl/LabelUtils.h>
#include <Tactility/file/File.h>
namespace tt::lvgl {
-9
View File
@@ -1,9 +0,0 @@
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
bool label_set_text_file(lv_obj_t* label, const char* filepath);
} // namespace
+3 -2
View File
@@ -1,5 +1,6 @@
#include "lvgl/LvglDisplay.h"
#include "Check.h"
#include "Tactility/lvgl/LvglDisplay.h"
#include <Tactility/Check.h>
namespace tt::lvgl {
-7
View File
@@ -1,7 +0,0 @@
#pragma once
#include "hal/Display.h"
namespace tt::lvgl {
hal::Display* getDisplay();
}
+6 -6
View File
@@ -1,11 +1,11 @@
#include "LvglKeypad.h"
#include "Tactility/lvgl/LvglKeypad.h"
namespace tt::lvgl {
static lv_indev_t* keyboard_device = NULL;
static lv_indev_t* keyboard_device = nullptr;
bool keypad_is_available() {
return keyboard_device != NULL;
return keyboard_device != nullptr;
}
void keypad_set_indev(lv_indev_t* device) {
@@ -13,14 +13,14 @@ void keypad_set_indev(lv_indev_t* device) {
}
void keypad_activate(lv_group_t* group) {
if (keyboard_device != NULL) {
if (keyboard_device != nullptr) {
lv_indev_set_group(keyboard_device, group);
}
}
void keypad_deactivate() {
if (keyboard_device != NULL) {
lv_indev_set_group(keyboard_device, NULL);
if (keyboard_device != nullptr) {
lv_indev_set_group(keyboard_device, nullptr);
}
}
-34
View File
@@ -1,34 +0,0 @@
/**
* This code relates to the hardware keyboard support also known as "keypads" in LVGL.
*/
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
/**
* @return true if LVGL is configured with a keypad
*/
bool keypad_is_available();
/**
* Set the keypad.
* @param device the keypad device
*/
void keypad_set_indev(lv_indev_t* device);
/**
* Activate the keypad for a widget group.
* @param group
*/
void keypad_activate(lv_group_t* group);
/**
* Deactivate the keypad for the current widget group (if any).
* You don't have to call this after calling _activate() because widget
* cleanup automatically removes itself from the group it belongs to.
*/
void keypad_deactivate();
} // namespace
+3 -2
View File
@@ -1,5 +1,6 @@
#include <Mutex.h>
#include "LvglSync.h"
#include "Tactility/lvgl/LvglSync.h"
#include <Tactility/Mutex.h>
namespace tt::lvgl {
-30
View File
@@ -1,30 +0,0 @@
#pragma once
#include "Lockable.h"
#include <memory>
namespace tt::lvgl {
/**
* LVGL locking function
* @param[in] timeoutMillis timeout in milliseconds. waits forever when 0 is passed.
* @warning this works with milliseconds, as opposed to every other FreeRTOS function that works in ticks!
* @warning when passing zero, we wait forever, as this is the default behaviour for esp_lvgl_port, and we want it to remain consistent
*/
typedef bool (*LvglLock)(uint32_t timeoutMillis);
typedef void (*LvglUnlock)();
void syncSet(LvglLock lock, LvglUnlock unlock);
/**
* LVGL locking function
* @param[in] timeout as ticks
* @warning when passing zero, we wait forever, as this is the default behaviour for esp_lvgl_port, and we want it to remain consistent
*/
bool lock(TickType_t timeout);
void unlock();
std::shared_ptr<Lockable> getLvglSyncLockable();
} // namespace
+5 -4
View File
@@ -1,9 +1,10 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include "Assets.h"
#include "CoreDefines.h"
#include "Log.h"
#include "lvgl.h"
#include <Tactility/Assets.h>
#include <Tactility/CoreDefines.h>
#include <Tactility/Log.h>
#include <lvgl.h>
namespace tt::lvgl {
-12
View File
@@ -1,12 +0,0 @@
#include "lvgl.h"
namespace tt::lvgl {
/**
* Create the Tactility spinner widget
* @param parent pointer to an object, it will be the parent of the new spinner.
* @return the created spinner
*/
lv_obj_t* spinner_create(lv_obj_t* parent);
}
+12 -11
View File
@@ -1,17 +1,18 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include <Timer.h>
#include "Statusbar.h"
#include "Tactility/lvgl/Statusbar.h"
#include "Mutex.h"
#include "PubSub.h"
#include "TactilityCore.h"
#include "lvgl/Style.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/LvglSync.h"
#include "LvglSync.h"
#include "lvgl.h"
#include "kernel/SystemEvents.h"
#include "time/Time.h"
#include <Tactility/kernel/SystemEvents.h>
#include <Tactility/Mutex.h>
#include <Tactility/PubSub.h>
#include <Tactility/TactilityCore.h>
#include <Tactility/Timer.h>
#include <Tactility/time/Time.h>
#include <lvgl.h>
namespace tt::lvgl {
@@ -46,7 +47,7 @@ typedef struct {
PubSub::SubscriptionHandle pubsub_subscription;
} Statusbar;
static bool statusbar_lock(uint32_t timeoutTicks = portMAX_DELAY) {
static bool statusbar_lock(TickType_t timeoutTicks = portMAX_DELAY) {
return statusbar_data.mutex.lock(timeoutTicks);
}
-19
View File
@@ -1,19 +0,0 @@
#pragma once
#include "lvgl.h"
#include "app/AppContext.h"
namespace tt::lvgl {
#define STATUSBAR_ICON_LIMIT 8
#define STATUSBAR_ICON_SIZE 20
#define STATUSBAR_HEIGHT (STATUSBAR_ICON_SIZE + 4) // 4 extra pixels for border and outline
lv_obj_t* statusbar_create(lv_obj_t* parent);
int8_t statusbar_icon_add(const std::string& image);
int8_t statusbar_icon_add();
void statusbar_icon_remove(int8_t id);
void statusbar_icon_set_image(int8_t id, const std::string& image);
void statusbar_icon_set_visibility(int8_t id, bool visible);
} // namespace
+1 -1
View File
@@ -1,4 +1,4 @@
#include "Style.h"
#include "Tactility/lvgl/Style.h"
namespace tt::lvgl {
-20
View File
@@ -1,20 +0,0 @@
#pragma once
#include "lvgl.h"
namespace tt::lvgl {
void obj_set_style_bg_blacken(lv_obj_t* obj);
void obj_set_style_bg_invisible(lv_obj_t* obj);
void obj_set_style_no_padding(lv_obj_t* obj);
/**
* This is to create automatic padding depending on the screen size.
* The larger the screen, the more padding it gets.
* TODO: It currently only applies a single basic padding, but will be improved later.
*
* @param obj
*/
void obj_set_style_auto_padding(lv_obj_t* obj);
} // namespace
+4 -4
View File
@@ -1,10 +1,10 @@
#define LV_USE_PRIVATE_API 1 // For actual lv_obj_t declaration
#include "Toolbar.h"
#include "Tactility/lvgl/Toolbar.h"
#include "service/loader/Loader.h"
#include "lvgl/Style.h"
#include "Spinner.h"
#include "Tactility/service/loader/Loader.h"
#include "Tactility/lvgl/Style.h"
#include "Tactility/lvgl/Spinner.h"
namespace tt::lvgl {
-20
View File
@@ -1,20 +0,0 @@
#pragma once
#include "lvgl.h"
#include "app/AppContext.h"
namespace tt::lvgl {
#define TOOLBAR_HEIGHT 40
#define TOOLBAR_TITLE_FONT_HEIGHT 18
#define TOOLBAR_ACTION_LIMIT 4
lv_obj_t* toolbar_create(lv_obj_t* parent, const std::string& title);
lv_obj_t* toolbar_create(lv_obj_t* parent, const app::AppContext& app);
void toolbar_set_title(lv_obj_t* obj, const std::string& title);
void toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
lv_obj_t* toolbar_add_button_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* user_data);
lv_obj_t* toolbar_add_switch_action(lv_obj_t* obj);
lv_obj_t* toolbar_add_spinner_action(lv_obj_t* obj);
} // namespace