* SdCard HAL refactored (#135) - Refactor SdCard HAL - introduce Lockable * Screenshot and FatFS improvements (#136) - Fix screenshots on ESP32 - Improve Screenshot service - Convert Screenshot app to class-based instead of structs - Screenshot app now automatically updates when task is finished - Enable FatFS long filename support * Re-use common log messages (#138) For consistency and binary size reduction * Toolbar spinner should get margin to the right * More TactilityC features (#139) * Rewrote Loader - Simplified Loader by removing custom threa - Created DispatcherThread - Move auto-starting apps to Boot app - Fixed Dispatcher bug where it could get stuck not processing new messages * Hide AP settings if the AP is not saved * Missing from previous commit * Replace LV_EVENT_CLICKED with LV_EVENT_SHORT_CLICKED * Refactored files app and created InputDialog (#140) - Changed Files app so that it has a View and State - Files app now allows for long-pressing on files to perform actions - Files app now has rename and delete actions - Created InputDialog app - Improved AlertDialog app layout
78 lines
2.0 KiB
C++
78 lines
2.0 KiB
C++
#include "tt_thread.h"
|
|
#include <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
|
|
);
|
|
}
|
|
|
|
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_mark_as_static(ThreadHandle handle) {
|
|
HANDLE_AS_THREAD(handle)->markAsStatic();
|
|
}
|
|
|
|
bool tt_thread_is_marked_as_static(ThreadHandle handle) {
|
|
return HANDLE_AS_THREAD(handle)->isMarkedAsStatic();
|
|
}
|
|
|
|
void tt_thread_set_stack_size(ThreadHandle handle, size_t size) {
|
|
HANDLE_AS_THREAD(handle)->setStackSize(size);
|
|
}
|
|
|
|
void tt_thread_set_callback(ThreadHandle handle, ThreadCallback callback, void* _Nullable callbackContext) {
|
|
HANDLE_AS_THREAD(handle)->setCallback(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) {
|
|
return HANDLE_AS_THREAD(handle)->join();
|
|
}
|
|
|
|
ThreadId tt_thread_get_id(ThreadHandle handle) {
|
|
return HANDLE_AS_THREAD(handle)->getId();
|
|
}
|
|
|
|
int32_t tt_thread_get_return_code(ThreadHandle handle) {
|
|
return HANDLE_AS_THREAD(handle)->getReturnCode();
|
|
}
|
|
|
|
} |