mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-05 19:01:54 +00:00
Rename to STA RTOS
This commit is contained in:
41
include/sta/rtos/queue.tpp
Normal file
41
include/sta/rtos/queue.tpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#ifndef STA_RTOS_QUEUE_TPP
|
||||
#define STA_RTOS_QUEUE_TPP
|
||||
|
||||
#ifndef STA_RTOS_QUEUE_HPP
|
||||
# error "Internal header. Use <sta/rtos/queue.hpp> instead."
|
||||
#endif // !STA_RTOS_QUEUE_HPP
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
template <typename T>
|
||||
RTOSQueue<T>::RTOSQueue(osMessageQueueId_t * handle)
|
||||
: handle_{handle}
|
||||
{
|
||||
STA_ASSERT(handle != nullptr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool RTOSQueue<T>::put(const Message & msg, uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
return (osOK == osMessageQueuePut(*handle_, &msg, 0, timeout));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool RTOSQueue<T>::get(Message * outMsg, uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
uint8_t prio;
|
||||
return (osOK == osMessageQueueGet(*handle_, outMsg, &prio, timeout));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
uint32 RTOSQueue<T>::available() const
|
||||
{
|
||||
return osMessageQueueGetCount(*handle_);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_RTOS_QUEUE_TPP
|
Reference in New Issue
Block a user