TactilitySDK updates (#442)
- Removed custom `TickType` - Removed TactilityC functionality that is now covered by TactilityFreeRtos
This commit is contained in:
committed by
GitHub
parent
524b197105
commit
812c2901db
@@ -55,7 +55,7 @@ void tt_hal_display_driver_free(DisplayDriverHandle handle) {
|
||||
delete wrapper;
|
||||
}
|
||||
|
||||
bool tt_hal_display_driver_lock(DisplayDriverHandle handle, TickType timeout) {
|
||||
bool tt_hal_display_driver_lock(DisplayDriverHandle handle, TickType_t timeout) {
|
||||
auto wrapper = static_cast<DriverWrapper*>(handle);
|
||||
return wrapper->driver->getLock()->lock(timeout);
|
||||
}
|
||||
|
||||
@@ -53,15 +53,15 @@ bool tt_hal_uart_stop(UartHandle handle) {
|
||||
return HANDLE_AS_UART(handle)->stop();
|
||||
}
|
||||
|
||||
size_t tt_hal_uart_read_bytes(UartHandle handle, char* buffer, size_t bufferSize, TickType timeout) {
|
||||
size_t tt_hal_uart_read_bytes(UartHandle handle, char* buffer, size_t bufferSize, TickType_t timeout) {
|
||||
return HANDLE_AS_UART(handle)->readBytes(reinterpret_cast<std::byte*>(buffer), bufferSize, timeout);
|
||||
}
|
||||
|
||||
bool tt_hal_uart_read_byte(UartHandle handle, char* output, TickType timeout) {
|
||||
bool tt_hal_uart_read_byte(UartHandle handle, char* output, TickType_t timeout) {
|
||||
return HANDLE_AS_UART(handle)->readByte(reinterpret_cast<std::byte*>(output), timeout);
|
||||
}
|
||||
|
||||
size_t tt_hal_uart_write_bytes(UartHandle handle, const char* buffer, size_t bufferSize, TickType timeout) {
|
||||
size_t tt_hal_uart_write_bytes(UartHandle handle, const char* buffer, size_t bufferSize, TickType_t timeout) {
|
||||
return HANDLE_AS_UART(handle)->writeBytes(reinterpret_cast<const std::byte*>(buffer), bufferSize, timeout);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,12 +17,8 @@
|
||||
#include "tt_lvgl_keyboard.h"
|
||||
#include "tt_lvgl_spinner.h"
|
||||
#include "tt_lvgl_toolbar.h"
|
||||
#include "tt_message_queue.h"
|
||||
#include "tt_preferences.h"
|
||||
#include "tt_semaphore.h"
|
||||
#include "tt_thread.h"
|
||||
#include "tt_time.h"
|
||||
#include "tt_timer.h"
|
||||
#include "tt_wifi.h"
|
||||
|
||||
#include "symbols/esp_event.h"
|
||||
@@ -49,7 +45,6 @@
|
||||
#include <esp_random.h>
|
||||
#include <esp_sntp.h>
|
||||
#include <esp_netif.h>
|
||||
#include <esp_wifi.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
@@ -199,7 +194,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_mutex),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_alloc_for_path),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_acquire),
|
||||
ESP_ELFSYM_EXPORT(tt_lock_release),
|
||||
@@ -281,12 +275,6 @@ const esp_elfsym main_symbols[] {
|
||||
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_message_queue_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_free),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_put),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_get),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_get_count),
|
||||
ESP_ELFSYM_EXPORT(tt_message_queue_reset),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_free),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_opt_bool),
|
||||
@@ -295,35 +283,6 @@ const esp_elfsym main_symbols[] {
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_put_bool),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_put_int32),
|
||||
ESP_ELFSYM_EXPORT(tt_preferences_put_string),
|
||||
ESP_ELFSYM_EXPORT(tt_semaphore_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_semaphore_free),
|
||||
ESP_ELFSYM_EXPORT(tt_semaphore_acquire),
|
||||
ESP_ELFSYM_EXPORT(tt_semaphore_release),
|
||||
ESP_ELFSYM_EXPORT(tt_semaphore_get_count),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_alloc_ext),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_free),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_name),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_stack_size),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_affinity),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_callback),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_priority),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_set_state_callback),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_get_state),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_start),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_join),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_get_task_handle),
|
||||
ESP_ELFSYM_EXPORT(tt_thread_get_return_code),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_alloc),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_free),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_start),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_reset),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_reset_with_interval),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_stop),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_is_running),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_get_expiry_time),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_set_pending_callback),
|
||||
ESP_ELFSYM_EXPORT(tt_timer_set_thread_priority),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_set),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_get_name),
|
||||
ESP_ELFSYM_EXPORT(tt_timezone_get_code),
|
||||
|
||||
@@ -8,27 +8,12 @@
|
||||
|
||||
extern "C" {
|
||||
|
||||
LockHandle tt_lock_alloc_mutex(TtMutexType type) {
|
||||
auto* lock_holder = new LockHolder();
|
||||
switch (type) {
|
||||
case MutexTypeNormal:
|
||||
lock_holder->lock = std::make_shared<tt::Mutex>();
|
||||
break;
|
||||
case MutexTypeRecursive:
|
||||
lock_holder->lock = std::make_shared<tt::RecursiveMutex>();
|
||||
break;
|
||||
default:
|
||||
tt_crash("Type not supported");
|
||||
}
|
||||
return lock_holder;
|
||||
}
|
||||
|
||||
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 timeout) {
|
||||
bool tt_lock_acquire(LockHandle handle, TickType_t timeout) {
|
||||
return HANDLE_AS_LOCK(handle)->lock(timeout);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <tt_kernel.h>
|
||||
#include <Tactility/lvgl/Lvgl.h>
|
||||
#include <Tactility/lvgl/LvglSync.h>
|
||||
|
||||
@@ -16,8 +15,8 @@ void tt_lvgl_stop() {
|
||||
tt::lvgl::stop();
|
||||
}
|
||||
|
||||
void tt_lvgl_lock(TickType timeout) {
|
||||
tt::lvgl::getSyncLock()->lock(timeout);
|
||||
bool tt_lvgl_lock(TickType_t timeout) {
|
||||
return tt::lvgl::getSyncLock()->lock(timeout);
|
||||
}
|
||||
|
||||
void tt_lvgl_unlock() {
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
#include "tt_message_queue.h"
|
||||
#include <Tactility/MessageQueue.h>
|
||||
|
||||
#define HANDLE_TO_MESSAGE_QUEUE(handle) ((tt::MessageQueue*)(handle))
|
||||
|
||||
extern "C" {
|
||||
|
||||
MessageQueueHandle tt_message_queue_alloc(uint32_t capacity, uint32_t messageSize) {
|
||||
return new tt::MessageQueue(capacity, messageSize);
|
||||
}
|
||||
|
||||
void tt_message_queue_free(MessageQueueHandle handle) {
|
||||
delete HANDLE_TO_MESSAGE_QUEUE(handle);
|
||||
}
|
||||
|
||||
bool tt_message_queue_put(MessageQueueHandle handle, const void* message, TickType_t timeout) {
|
||||
return HANDLE_TO_MESSAGE_QUEUE(handle)->put(message, timeout);
|
||||
}
|
||||
|
||||
bool tt_message_queue_get(MessageQueueHandle handle, void* message, TickType_t timeout) {
|
||||
return HANDLE_TO_MESSAGE_QUEUE(handle)->get(message, timeout);
|
||||
}
|
||||
|
||||
uint32_t tt_message_queue_get_count(MessageQueueHandle handle) {
|
||||
return HANDLE_TO_MESSAGE_QUEUE(handle)->getCount();
|
||||
}
|
||||
|
||||
void tt_message_queue_reset(MessageQueueHandle handle) {
|
||||
return HANDLE_TO_MESSAGE_QUEUE(handle)->reset();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
#include "tt_semaphore.h"
|
||||
#include <Tactility/Semaphore.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define HANDLE_AS_SEMAPHORE(handle) ((tt::Semaphore*)(handle))
|
||||
|
||||
SemaphoreHandle tt_semaphore_alloc(uint32_t maxCount, TickType_t initialCount) {
|
||||
return new tt::Semaphore(maxCount, initialCount);
|
||||
}
|
||||
|
||||
void tt_semaphore_free(SemaphoreHandle handle) {
|
||||
delete HANDLE_AS_SEMAPHORE(handle);
|
||||
}
|
||||
|
||||
bool tt_semaphore_acquire(SemaphoreHandle handle, TickType_t timeoutTicks) {
|
||||
return HANDLE_AS_SEMAPHORE(handle)->acquire(timeoutTicks);
|
||||
}
|
||||
|
||||
bool tt_semaphore_release(SemaphoreHandle handle) {
|
||||
return HANDLE_AS_SEMAPHORE(handle)->release();
|
||||
}
|
||||
|
||||
uint32_t tt_semaphore_get_count(SemaphoreHandle handle) {
|
||||
return HANDLE_AS_SEMAPHORE(handle)->getAvailable();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
#include "tt_thread.h"
|
||||
#include <Tactility/Thread.h>
|
||||
|
||||
extern "C" {
|
||||
|
||||
#define HANDLE_AS_THREAD(handle) ((tt::Thread*)(handle))
|
||||
|
||||
ThreadHandle tt_thread_alloc() {
|
||||
return new tt::Thread();
|
||||
}
|
||||
|
||||
ThreadHandle tt_thread_alloc_ext(
|
||||
const char* name,
|
||||
uint32_t stackSize,
|
||||
ThreadCallback callback,
|
||||
void* _Nullable callbackContext
|
||||
) {
|
||||
return new tt::Thread(
|
||||
name,
|
||||
stackSize,
|
||||
[callback, callbackContext] {
|
||||
return callback(callbackContext);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void tt_thread_free(ThreadHandle handle) {
|
||||
delete HANDLE_AS_THREAD(handle);
|
||||
}
|
||||
|
||||
void tt_thread_set_name(ThreadHandle handle, const char* name) {
|
||||
HANDLE_AS_THREAD(handle)->setName(name);
|
||||
}
|
||||
|
||||
void tt_thread_set_stack_size(ThreadHandle handle, size_t size) {
|
||||
HANDLE_AS_THREAD(handle)->setStackSize(size);
|
||||
}
|
||||
|
||||
void tt_thread_set_affinity(ThreadHandle handle, int affinity) {
|
||||
HANDLE_AS_THREAD(handle)->setAffinity(affinity);
|
||||
}
|
||||
|
||||
void tt_thread_set_callback(ThreadHandle handle, ThreadCallback callback, void* _Nullable callbackContext) {
|
||||
HANDLE_AS_THREAD(handle)->setMainFunction([callback, callbackContext]() {
|
||||
return callback(callbackContext);
|
||||
});
|
||||
}
|
||||
|
||||
void tt_thread_set_priority(ThreadHandle handle, ThreadPriority priority) {
|
||||
HANDLE_AS_THREAD(handle)->setPriority((tt::Thread::Priority)priority);
|
||||
}
|
||||
|
||||
void tt_thread_set_state_callback(ThreadHandle handle, ThreadStateCallback callback, void* _Nullable callbackContext) {
|
||||
HANDLE_AS_THREAD(handle)->setStateCallback((tt::Thread::StateCallback)callback, callbackContext);
|
||||
}
|
||||
|
||||
ThreadState tt_thread_get_state(ThreadHandle handle) {
|
||||
return (ThreadState)HANDLE_AS_THREAD(handle)->getState();
|
||||
}
|
||||
|
||||
void tt_thread_start(ThreadHandle handle) {
|
||||
HANDLE_AS_THREAD(handle)->start();
|
||||
}
|
||||
|
||||
bool tt_thread_join(ThreadHandle handle, TickType_t timeout) {
|
||||
return HANDLE_AS_THREAD(handle)->join(timeout);
|
||||
}
|
||||
|
||||
TaskHandle tt_thread_get_task_handle(ThreadHandle handle) {
|
||||
return HANDLE_AS_THREAD(handle)->getTaskHandle();
|
||||
}
|
||||
|
||||
int32_t tt_thread_get_return_code(ThreadHandle handle) {
|
||||
return HANDLE_AS_THREAD(handle)->getReturnCode();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
#include "tt_timer.h"
|
||||
#include <Tactility/Timer.h>
|
||||
|
||||
struct TimerWrapper {
|
||||
std::unique_ptr<tt::Timer> timer;
|
||||
};
|
||||
|
||||
#define HANDLE_TO_WRAPPER(handle) static_cast<TimerWrapper*>(handle)
|
||||
|
||||
extern "C" {
|
||||
|
||||
TimerHandle tt_timer_alloc(TimerType type, TickType ticks, TimerCallback callback, void* callbackContext) {
|
||||
auto wrapper = new TimerWrapper;
|
||||
wrapper->timer = std::make_unique<tt::Timer>(static_cast<tt::Timer::Type>(type), ticks, [callback, callbackContext](){ callback(callbackContext); });
|
||||
return wrapper;
|
||||
}
|
||||
|
||||
void tt_timer_free(TimerHandle handle) {
|
||||
auto* wrapper = static_cast<TimerWrapper*>(handle);
|
||||
wrapper->timer = nullptr;
|
||||
delete wrapper;
|
||||
}
|
||||
|
||||
bool tt_timer_start(TimerHandle handle) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->start();
|
||||
}
|
||||
|
||||
bool tt_timer_reset(TimerHandle handle) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->reset();
|
||||
}
|
||||
|
||||
bool tt_timer_reset_with_interval(TimerHandle handle, TickType interval) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->reset(interval);
|
||||
}
|
||||
|
||||
bool tt_timer_stop(TimerHandle handle) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->stop();
|
||||
}
|
||||
|
||||
bool tt_timer_is_running(TimerHandle handle) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->isRunning();
|
||||
}
|
||||
|
||||
uint32_t tt_timer_get_expiry_time(TimerHandle handle) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->getExpiryTime();
|
||||
}
|
||||
|
||||
bool tt_timer_set_pending_callback(TimerHandle handle, TimerPendingCallback callback, void* callbackContext, uint32_t callbackArg, TickType_t timeoutTicks) {
|
||||
return HANDLE_TO_WRAPPER(handle)->timer->setPendingCallback(
|
||||
callback,
|
||||
callbackContext,
|
||||
callbackArg,
|
||||
timeoutTicks
|
||||
);
|
||||
}
|
||||
|
||||
void tt_timer_set_thread_priority(TimerHandle handle, ThreadPriority priority) {
|
||||
HANDLE_TO_WRAPPER(handle)->timer->setCallbackPriority(static_cast<tt::Thread::Priority>(priority));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user