Create TactilityFreertos subproject (#440)
This commit is contained in:
committed by
GitHub
parent
a4dc633063
commit
7283920def
@@ -103,9 +103,8 @@ bool tt_hal_i2c_lock(i2c_port_t port, TickType_t timeout);
|
||||
/**
|
||||
* Used to unlock an I2C port.
|
||||
* This is useful for creating thread-safe I2C calls while calling ESP-IDF directly of third party I2C APIs.
|
||||
* @param[in] port the I2C port to unlock
|
||||
*/
|
||||
bool tt_hal_i2c_unlock(i2c_port_t port);
|
||||
void tt_hal_i2c_unlock(i2c_port_t port);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
@@ -11,43 +9,6 @@ typedef unsigned long TickType;
|
||||
|
||||
#define TT_MAX_TICKS ((TickType)(~(TickType)0))
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in milliseconds to stall.
|
||||
*/
|
||||
void tt_kernel_delay_millis(uint32_t milliseconds);
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in microsends to stall.
|
||||
*/
|
||||
void tt_kernel_delay_micros(uint32_t microSeconds);
|
||||
|
||||
/**
|
||||
* Stall the current task for the specified amount of time.
|
||||
* @param milliseconds the time in ticks to stall.
|
||||
*/
|
||||
void tt_kernel_delay_ticks(TickType ticks);
|
||||
|
||||
/** @return the number of ticks since the device was started */
|
||||
TickType tt_kernel_get_ticks();
|
||||
|
||||
/** Convert milliseconds to ticks */
|
||||
TickType tt_kernel_millis_to_ticks(uint32_t milliSeconds);
|
||||
|
||||
/** Stall the current task until the specified timestamp
|
||||
* @return false if for some reason the delay was broken off
|
||||
*/
|
||||
bool tt_kernel_delay_until_tick(TickType tick);
|
||||
|
||||
/** @return the tick frequency of the kernel (commonly 1000 Hz when running FreeRTOS) */
|
||||
uint32_t tt_kernel_get_tick_frequency();
|
||||
|
||||
/** @return the number of milliseconds that have passed since the device was started */
|
||||
uint32_t tt_kernel_get_millis();
|
||||
|
||||
unsigned long tt_kernel_get_micros();
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -41,9 +41,8 @@ bool tt_lock_acquire(LockHandle handle, TickType timeout);
|
||||
/**
|
||||
* Attempt to unlock the lock.
|
||||
* @param[in] handle the handle that represents the mutex instance
|
||||
* @return true when the lock was unlocked
|
||||
*/
|
||||
bool tt_lock_release(LockHandle handle);
|
||||
void tt_lock_release(LockHandle handle);
|
||||
|
||||
/** Free the memory for this lock
|
||||
* This does not auto-release the lock.
|
||||
|
||||
@@ -41,23 +41,13 @@ bool tt_message_queue_put(MessageQueueHandle handle, const void* message, TickTy
|
||||
*/
|
||||
bool tt_message_queue_get(MessageQueueHandle handle, void* message, TickType_t timeout);
|
||||
|
||||
/** @return the total amount of messages that this queue can hold */
|
||||
uint32_t tt_message_queue_get_capacity(MessageQueueHandle handle);
|
||||
|
||||
/** @return the size of a single message in the queue */
|
||||
uint32_t tt_message_queue_get_message_size(MessageQueueHandle handle);
|
||||
|
||||
/** @return the current amount of items in the queue */
|
||||
uint32_t tt_message_queue_get_count(MessageQueueHandle handle);
|
||||
|
||||
/** @return the remaining capacity in the queue */
|
||||
uint32_t tt_message_queue_get_space(MessageQueueHandle handle);
|
||||
|
||||
/**
|
||||
* Remove all items from the queue (if any)
|
||||
* @return true on failure
|
||||
*/
|
||||
bool tt_message_queue_reset(MessageQueueHandle handle);
|
||||
void tt_message_queue_reset(MessageQueueHandle handle);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ typedef enum {
|
||||
} ThreadState;
|
||||
|
||||
/** The identifier that represents the thread */
|
||||
typedef TaskHandle_t ThreadId;
|
||||
typedef TaskHandle_t TaskHandle;
|
||||
|
||||
/** ThreadCallback Your callback to run in new thread
|
||||
* @warning never use osThreadExit in Thread
|
||||
@@ -132,16 +132,16 @@ void tt_thread_start(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)
|
||||
* @warning make sure you manually interrupt any logic in your thread (e.g. by an EventGroup or boolean+Mutex)
|
||||
*/
|
||||
bool tt_thread_join(ThreadHandle handle, TickType_t timeout);
|
||||
|
||||
/**
|
||||
* Get thread id
|
||||
* Get thread task handle
|
||||
* @param[in] handle the thread instance handle
|
||||
* @return the ThreadId of a thread
|
||||
* @return the task handle of a thread
|
||||
* */
|
||||
ThreadId tt_thread_get_id(ThreadHandle handle);
|
||||
TaskHandle tt_thread_get_task_handle(ThreadHandle handle);
|
||||
|
||||
/**
|
||||
* Get the return code of a thread
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "tt_kernel.h"
|
||||
#include "tt_thread.h"
|
||||
#include <freertos/FreeRTOS.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
@@ -15,8 +15,8 @@ typedef void* TimerHandle;
|
||||
|
||||
/** The behaviour of the timer */
|
||||
typedef enum {
|
||||
TimerTypeOnce = 0, ///< One-shot timer.
|
||||
TimerTypePeriodic = 1 ///< Repeating timer.
|
||||
TimerTypeOnce = 0, // Timer triggers once after time has passed
|
||||
TimerTypePeriodic = 1 // Timer triggers repeatedly after time has passed
|
||||
} TimerType;
|
||||
|
||||
typedef void (*TimerCallback)(void* context);
|
||||
@@ -27,7 +27,7 @@ typedef void (*TimerPendingCallback)(void* context, uint32_t arg);
|
||||
* @param[in] callback the callback to call when the timer expires
|
||||
* @param[in] callbackContext the data to pass to the callback
|
||||
*/
|
||||
TimerHandle tt_timer_alloc(TimerType type, TimerCallback callback, void* callbackContext);
|
||||
TimerHandle tt_timer_alloc(TimerType type, TickType ticks, TimerCallback callback, void* callbackContext);
|
||||
|
||||
/** Free up the memory of a timer instance */
|
||||
void tt_timer_free(TimerHandle handle);
|
||||
@@ -35,18 +35,24 @@ void tt_timer_free(TimerHandle handle);
|
||||
/**
|
||||
* Start the timer
|
||||
* @param[in] handle the timer instance handle
|
||||
* @parma[in] interval the interval of the timer
|
||||
* @return true when the timer was successfully started
|
||||
*/
|
||||
bool tt_timer_start(TimerHandle handle, TickType_t interval);
|
||||
bool tt_timer_start(TimerHandle handle);
|
||||
|
||||
/**
|
||||
* Restart an already started timer
|
||||
* @param[in] handle the timer instance handle
|
||||
* @parma[in] interval the interval of the timer
|
||||
* @param[in] interval the timer new interval
|
||||
* @return true when the timer was successfully restarted
|
||||
*/
|
||||
bool tt_timer_restart(TimerHandle handle, TickType_t interval);
|
||||
bool tt_timer_reset_with_interval(TimerHandle handle, TickType interval);
|
||||
|
||||
/**
|
||||
* Restart an already started timer
|
||||
* @param[in] handle the timer instance handle
|
||||
* @return true when the timer was successfully restarted
|
||||
*/
|
||||
bool tt_timer_reset(TimerHandle handle);
|
||||
|
||||
/**
|
||||
* Stop a started timer
|
||||
@@ -63,11 +69,11 @@ bool tt_timer_stop(TimerHandle handle);
|
||||
bool tt_timer_is_running(TimerHandle handle);
|
||||
|
||||
/**
|
||||
* Get the expire time of a timer
|
||||
* Get the expiry time of a timer
|
||||
* @param[in] handle the timer instance handle
|
||||
* @return the absolute timestamp at which the timer will expire
|
||||
*/
|
||||
uint32_t tt_timer_get_expire_time(TimerHandle handle);
|
||||
uint32_t tt_timer_get_expiry_time(TimerHandle handle);
|
||||
|
||||
/**
|
||||
* Set the pending callback for a timer
|
||||
|
||||
Reference in New Issue
Block a user