Migrate TactilityC and LVGL functionality (#588)
lvgl-module - Move and rename source and include files - Fix bug with missing lvgl unlock - New widgets: spinner, toolbar, sliderbox TactilityC - Removed tt_lock, tt_lvgl_\*
This commit is contained in:
committed by
GitHub
parent
cd2d9d6158
commit
b98a813f3c
@@ -1,48 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <freertos/FreeRTOS.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** A handle that represents a lock instance. A lock could be a Mutex or similar construct */
|
||||
typedef void* LockHandle;
|
||||
|
||||
typedef enum {
|
||||
MutexTypeNormal,
|
||||
MutexTypeRecursive
|
||||
} TtMutexType;
|
||||
|
||||
/**
|
||||
* Allocate a lock for a file or folder.
|
||||
* Locking is required before reading files for filesystems that are on a shared bus (e.g. SPI SD card sharing the bus with the display)
|
||||
* @param path the path to create the lock for
|
||||
* @return the allocated lock handle
|
||||
*/
|
||||
LockHandle tt_lock_alloc_for_path(const char* path);
|
||||
|
||||
/**
|
||||
* Attempt to lock the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
* @param[in] timeout the maximum amount of ticks to wait when trying to lock
|
||||
* @return true when the lock was acquired
|
||||
*/
|
||||
bool tt_lock_acquire(LockHandle handle, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Attempt to unlock the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
*/
|
||||
void tt_lock_release(LockHandle handle);
|
||||
|
||||
/** Free the memory for this lock
|
||||
* This does not auto-release the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
*/
|
||||
void tt_lock_free(LockHandle handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,55 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Show the on-screen keyboard.
|
||||
* @param[in] textarea the textarea to focus the input for
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea);
|
||||
|
||||
/**
|
||||
* Hide the on-screen keyboard.
|
||||
* Has no effect when the keyboard is not visible.
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_hide();
|
||||
|
||||
/**
|
||||
* The on-screen keyboard is only shown when both of these conditions are true:
|
||||
* - there is no hardware keyboard
|
||||
* - TT_CONFIG_FORCE_ONSCREEN_KEYBOARD is set to true in tactility_config.h
|
||||
* @return if we should show a on-screen keyboard for text input inside our apps
|
||||
*/
|
||||
bool tt_lvgl_software_keyboard_is_enabled();
|
||||
|
||||
/**
|
||||
* Activate the keypad for a widget group.
|
||||
* @param group
|
||||
*/
|
||||
void tt_lvgl_software_keyboard_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 tt_lvgl_software_keyboard_deactivate();
|
||||
|
||||
/**
|
||||
* @return true if LVGL is configured with a keypad
|
||||
*/
|
||||
bool tt_lvgl_hardware_keyboard_is_available();
|
||||
|
||||
/**
|
||||
* Set the keypad.
|
||||
* @param device the keypad device
|
||||
*/
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,14 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Create a spinner widget. */
|
||||
lv_obj_t* tt_lvgl_spinner_create(lv_obj_t* parent);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,72 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "tt_app.h"
|
||||
#include <lvgl.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/** Create a toolbar widget that shows the app name as title */
|
||||
lv_obj_t* tt_lvgl_toolbar_create_for_app(lv_obj_t* parent, AppHandle context);
|
||||
|
||||
/** Create a toolbar widget with the provided title*/
|
||||
lv_obj_t* tt_lvgl_toolbar_create(lv_obj_t* parent, const char* title);
|
||||
|
||||
/** Sets the toolbar title */
|
||||
void tt_lvgl_toolbar_set_title(lv_obj_t* obj, const char* title);
|
||||
|
||||
/** Sets the navigation action of the toolbar (button on the top-left)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] icon the icon to set on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackEventUserData the user data that is attached to the callback event object
|
||||
*/
|
||||
void tt_lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with an image to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] imagePath the path to an image file to shown on the button
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add an action button with text to the toolbar (aligned to the right of the toolbar)
|
||||
* @param[in] obj the toolbar instance
|
||||
* @param[in] text the button text
|
||||
* @param[in] callback the callback for the click action of the button
|
||||
* @param[in] callbackUserData the user data that is passed to the callback
|
||||
* @return an lv_button instance
|
||||
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData);
|
||||
|
||||
/**
|
||||
* Create and add a switch to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by lv_switch_create()
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_switch_action(lv_obj_t* obj);
|
||||
|
||||
/**
|
||||
* Create and add a spinner to the toolbar actions.
|
||||
* @param[in] obj the toolbar instance
|
||||
* @return an instance created by Tactility's spinner_create()
|
||||
*/
|
||||
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj);
|
||||
|
||||
|
||||
/**
|
||||
* Remove all actions from the toolbar
|
||||
* @param[in] obj the toolbar instance
|
||||
*/
|
||||
void tt_lvgl_toolbar_clear_actions(lv_obj_t* obj);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,8 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
#include <Tactility/Lock.h>
|
||||
|
||||
struct LockHolder {
|
||||
std::shared_ptr<tt::Lock> lock;
|
||||
};
|
||||
@@ -5,10 +5,6 @@
|
||||
#include "tt_app_fileselection.h"
|
||||
#include "tt_app_selectiondialog.h"
|
||||
#include "tt_bundle.h"
|
||||
#include <tt_lock.h>
|
||||
#include "tt_lvgl_keyboard.h"
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include "tt_preferences.h"
|
||||
#include "tt_time.h"
|
||||
|
||||
@@ -281,10 +277,6 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_user_data_child_path),
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_assets_path),
|
||||
ESP_ELFSYM_EXPORT(tt_app_get_assets_child_path),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_alloc_for_path),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_acquire),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_release),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_free),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_free),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_opt_bool),
|
||||
@@ -293,22 +285,6 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_bool),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_int32),
|
||||
ESP_ELFSYM_EXPORT(tt_bundle_put_string),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_show),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_hide),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_is_enabled),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_activate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_software_keyboard_deactivate),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_is_available),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_hardware_keyboard_set_indev),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_create_for_app),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_set_title),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_set_nav_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_image_button_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_text_button_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_switch_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_add_spinner_action),
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_toolbar_clear_actions),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_free),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_opt_bool),
|
||||
@@ -322,8 +298,6 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_get_code),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_is_format_24_hour),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_set_format_24_hour),
|
||||
// tt::lvgl
|
||||
ESP_ELFSYM_EXPORT(tt_lvgl_spinner_create),
|
||||
|
||||
// stdio.h
|
||||
ESP_ELFSYM_EXPORT(rename),
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
#include <Tactility/Mutex.h>
|
||||
#include <Tactility/RecursiveMutex.h>
|
||||
#include <Tactility/file/File.h>
|
||||
#include <tt_lock.h>
|
||||
#include <tt_lock_private.h>
|
||||
|
||||
#define HANDLE_AS_LOCK(handle) (static_cast<LockHolder*>(handle)->lock)
|
||||
|
||||
extern "C" {
|
||||
|
||||
LockHandle tt_lock_alloc_for_path(const char* path) {
|
||||
const auto lock = tt::file::getLock(path);
|
||||
return new LockHolder(lock);
|
||||
}
|
||||
|
||||
bool tt_lock_acquire(LockHandle handle, TickType_t timeout) {
|
||||
return HANDLE_AS_LOCK(handle)->lock(timeout);
|
||||
}
|
||||
|
||||
void tt_lock_release(LockHandle handle) {
|
||||
HANDLE_AS_LOCK(handle)->unlock();
|
||||
}
|
||||
|
||||
void tt_lock_free(LockHandle handle) {
|
||||
const auto holder = static_cast<LockHolder*>(handle);
|
||||
delete holder;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
#include "Tactility/lvgl/Keyboard.h"
|
||||
|
||||
extern "C" {
|
||||
|
||||
void tt_lvgl_software_keyboard_show(lv_obj_t* textarea) {
|
||||
tt::lvgl::software_keyboard_show(textarea);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_hide() {
|
||||
tt::lvgl::software_keyboard_hide();
|
||||
}
|
||||
|
||||
bool tt_lvgl_software_keyboard_is_enabled() {
|
||||
return tt::lvgl::software_keyboard_is_enabled();
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_activate(lv_group_t* group) {
|
||||
tt::lvgl::software_keyboard_activate(group);
|
||||
}
|
||||
|
||||
void tt_lvgl_software_keyboard_deactivate() {
|
||||
tt::lvgl::software_keyboard_deactivate();
|
||||
}
|
||||
|
||||
bool tt_lvgl_hardware_keyboard_is_available() {
|
||||
return tt::lvgl::hardware_keyboard_is_available();
|
||||
}
|
||||
|
||||
void tt_lvgl_hardware_keyboard_set_indev(lv_indev_t* device) {
|
||||
tt::lvgl::hardware_keyboard_set_indev(device);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include <Tactility/lvgl/Spinner.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
lv_obj_t* tt_lvgl_spinner_create(lv_obj_t* parent) {
|
||||
return tt::lvgl::spinner_create(parent);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include <Tactility/lvgl/Toolbar.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_create(lv_obj_t* parent, const char* title) {
|
||||
return tt::lvgl::toolbar_create(parent, title);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_create_for_app(lv_obj_t* parent, AppHandle context) {
|
||||
return tt::lvgl::toolbar_create(parent, *(tt::app::AppContext*)context);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_set_title(lv_obj_t* obj, const char* title) {
|
||||
tt::lvgl::toolbar_set_title(obj, title);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_set_nav_action(lv_obj_t* obj, const char* icon, lv_event_cb_t callback, void* callbackEventUserData) {
|
||||
tt::lvgl::toolbar_set_nav_action(obj, icon, callback, callbackEventUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_image_button_action(lv_obj_t* obj, const char* imagePath, lv_event_cb_t callback, void* callbackUserData) {
|
||||
return tt::lvgl::toolbar_add_image_button_action(obj, imagePath, callback, callbackUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_text_button_action(lv_obj_t* obj, const char* text, lv_event_cb_t callback, void* callbackUserData) {
|
||||
return tt::lvgl::toolbar_add_text_button_action(obj, text, callback, callbackUserData);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_switch_action(lv_obj_t* obj) {
|
||||
return tt::lvgl::toolbar_add_switch_action(obj);
|
||||
}
|
||||
|
||||
lv_obj_t* tt_lvgl_toolbar_add_spinner_action(lv_obj_t* obj) {
|
||||
return tt::lvgl::toolbar_add_spinner_action(obj);
|
||||
}
|
||||
|
||||
void tt_lvgl_toolbar_clear_actions(lv_obj_t* obj) {
|
||||
tt::lvgl::toolbar_clear_actions(obj);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user