mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-06-11 02:26:00 +00:00
Added flags clear for thread and new constructor for queue.
This commit is contained in:
parent
0e96b2ec29
commit
c609dc81cc
@ -34,6 +34,11 @@ namespace sta
|
|||||||
*/
|
*/
|
||||||
RtosQueue(osMessageQueueId_t handle);
|
RtosQueue(osMessageQueueId_t handle);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param length The maximum number of elements to be stored in the queue.
|
||||||
|
*/
|
||||||
|
RtosQueue(uint32_t length);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Place message in queue.
|
* @brief Place message in queue.
|
||||||
*
|
*
|
||||||
|
@ -21,6 +21,13 @@ namespace sta
|
|||||||
{
|
{
|
||||||
STA_ASSERT(handle != nullptr);
|
STA_ASSERT(handle != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
RtosQueue<T>::RtosQueue(uint32_t length)
|
||||||
|
: handle_{osMessageQueueNew(length, sizeof(Message), NULL)}
|
||||||
|
{
|
||||||
|
STA_ASSERT(handle_ != NULL);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool RtosQueue<T>::put(const Message & msg, uint32_t timeout /* = osWaitForever */)
|
bool RtosQueue<T>::put(const Message & msg, uint32_t timeout /* = osWaitForever */)
|
||||||
|
@ -98,6 +98,13 @@ namespace sta
|
|||||||
*/
|
*/
|
||||||
uint32_t wait(uint32_t flags);
|
uint32_t wait(uint32_t flags);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Clears the thread flags set for this thread.
|
||||||
|
*
|
||||||
|
* @return Returns the thread flags that set before clearing.
|
||||||
|
*/
|
||||||
|
uint32_t clear(uint32_t flags);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Send termination request to thread.
|
* @brief Send termination request to thread.
|
||||||
*/
|
*/
|
||||||
|
@ -41,6 +41,15 @@ namespace sta
|
|||||||
return osThreadFlagsWait(flags, osFlagsWaitAny, osWaitForever);
|
return osThreadFlagsWait(flags, osFlagsWaitAny, osWaitForever);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t RtosThread::clear(uint32_t flags)
|
||||||
|
{
|
||||||
|
uint32_t setFlags = osThreadFlagsClear(flags);
|
||||||
|
|
||||||
|
STA_ASSERT(setFlags != (uint32_t)osError);
|
||||||
|
|
||||||
|
return setFlags;
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t RtosThread::getFlags()
|
uint32_t RtosThread::getFlags()
|
||||||
{
|
{
|
||||||
STA_ASSERT(handle_.get() != nullptr);
|
STA_ASSERT(handle_.get() != nullptr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user