Merge develop into main (#167)
- WiFi Connect app is now hidden by default, but accessible at the bottom of the WiFi Manage app when WiFi is turned on. - WiFi service now turns on WiFi when calling connect() and WiFi is not on. - Removed `blocking` option for `service::loader::startApp()`. This feature was unused and complex. - Various apps: Moved private headers into Private/ folder. - Various apps: created start() function for easy starting. - Added documentation to all TactilityC APIs - Refactored various `enum` into `class enum` - Refactor M5Stack `initBoot()` (but VBus is still 0V for some reason)
This commit is contained in:
committed by
GitHub
parent
3ca0f8cf97
commit
3ea02d912f
@@ -16,14 +16,17 @@ extern "C" {
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/** The handle that represents the thread insance */
|
||||
typedef void* ThreadHandle;
|
||||
|
||||
/** The state of a thread instance */
|
||||
typedef enum {
|
||||
ThreadStateStopped,
|
||||
ThreadStateStarting,
|
||||
ThreadStateRunning,
|
||||
} ThreadState;
|
||||
|
||||
/** The identifier that represents the thread */
|
||||
typedef TaskHandle_t ThreadId;
|
||||
|
||||
/** ThreadCallback Your callback to run in new thread
|
||||
@@ -48,23 +51,98 @@ typedef enum {
|
||||
ThreadPriorityHighest = 7U
|
||||
} ThreadPriority;
|
||||
|
||||
/** @return a thread handle that represents a newly allocated thread instance */
|
||||
ThreadHandle tt_thread_alloc();
|
||||
|
||||
/**
|
||||
* Allocate a thread and provide some common parameters so it's all ready to be started.
|
||||
* @param[in] name the name of the thread
|
||||
* @param[in] stackSize the size of the stack in bytes
|
||||
* @param[in] callback the callback to call from the thread
|
||||
* @param[in] callbackContext the data to pass to the callback
|
||||
*/
|
||||
ThreadHandle tt_thread_alloc_ext(
|
||||
const char* name,
|
||||
uint32_t stackSize,
|
||||
ThreadCallback callback,
|
||||
void* _Nullable callbackContext
|
||||
);
|
||||
|
||||
/**
|
||||
* Free up the memory of the thread that is represented by this handle
|
||||
* @param[in] handle the thread instance handle
|
||||
*/
|
||||
void tt_thread_free(ThreadHandle handle);
|
||||
|
||||
/**
|
||||
* Set the name of a thread
|
||||
* @param[in] handle the thread instance handle
|
||||
* @param[in] name the name to set
|
||||
*/
|
||||
void tt_thread_set_name(ThreadHandle handle, const char* name);
|
||||
|
||||
/**
|
||||
* Set the stack size of the thread (in bytes)
|
||||
* @param[in] handle the thread instance handle
|
||||
* @param[in] the size of the thread in bytes
|
||||
*/
|
||||
void tt_thread_set_stack_size(ThreadHandle handle, size_t size);
|
||||
|
||||
/**
|
||||
* Set the callback for a thread. This method is executed when the thread is started.
|
||||
* @param[in] handle the thread instance handle
|
||||
* @param[in] callback the callback to set
|
||||
* @param[in] callbackContext the data to pass to the callback
|
||||
*/
|
||||
void tt_thread_set_callback(ThreadHandle handle, ThreadCallback callback, void* _Nullable callbackContext);
|
||||
|
||||
/**
|
||||
* Set the priority of a thread
|
||||
* @param[in] handle the thread instance handle
|
||||
* @param[in] priority the priority to set
|
||||
*/
|
||||
void tt_thread_set_priority(ThreadHandle handle, ThreadPriority priority);
|
||||
|
||||
/**
|
||||
* Set the state callback for a thread
|
||||
* @param[in] handle the thread instance handle
|
||||
* @param[in] callback the callback to set
|
||||
* @param[in] callbackContext the data to pass to the callback
|
||||
*/
|
||||
void tt_thread_set_state_callback(ThreadHandle handle, ThreadStateCallback callback, void* _Nullable callbackContext);
|
||||
|
||||
/**
|
||||
* @param[in] handle the thread instance handle
|
||||
* @return the current state of a thread
|
||||
*/
|
||||
ThreadState tt_thread_get_state(ThreadHandle handle);
|
||||
|
||||
/**
|
||||
* Start a thread
|
||||
* @param[in] handle the thread instance handle
|
||||
*/
|
||||
void tt_thread_start(ThreadHandle handle);
|
||||
bool tt_thread_join(ThreadHandle handle);
|
||||
|
||||
/**
|
||||
* Wait (block) for the thread to finish.
|
||||
* @param[in] handle the thread instance handle
|
||||
* @warning make sure you manually interrupt any logic in your thread (e.g. by an EventFlag or boolean+Mutex)
|
||||
*/
|
||||
bool tt_thread_join(ThreadHandle handle, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Get thread id
|
||||
* @param[in] handle the thread instance handle
|
||||
* @return the ThreadId of a thread
|
||||
* */
|
||||
ThreadId tt_thread_get_id(ThreadHandle handle);
|
||||
|
||||
/**
|
||||
* Get the return code of a thread
|
||||
* @warning crashes when state is not "stopped"
|
||||
* @param[in] handle the thread instance handle
|
||||
* @return the return code of a thread or
|
||||
*/
|
||||
int32_t tt_thread_get_return_code(ThreadHandle handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
Reference in New Issue
Block a user