mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-05 19:01:54 +00:00
Improve doxygen comments. Add HAL init
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @brief Constants and macros for use with CMSIS RTOS2.
|
||||
*/
|
||||
#ifndef STA_OS2_DEFS_HPP
|
||||
#define STA_OS2_DEFS_HPP
|
||||
|
||||
|
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
* @brief Helper for easy system task setup in `<sta/config.hpp>`.
|
||||
*
|
||||
* Define **STA_OS2_SYSTEM_TASKS_ENABLE** before including this header
|
||||
* to enable all system tasks and required features.
|
||||
* Configuration:
|
||||
* STA_OS2_SYSTEM_TASKS_ENABLE: Enable all system tasks and required features
|
||||
* STA_OS2_WATCHDOG_TIMER_NAME: Set watchdog timer handle and callback names based on this
|
||||
* STA_OS2_WATCHDOG_NAME: Set watchdog task handle and entry function names based on this
|
||||
*/
|
||||
#ifndef STA_OS2_EASY_CONFIG_HPP
|
||||
#define STA_OS2_EASY_CONFIG_HPP
|
||||
|
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @brief CMSIS RTOS2 mutex implementation.
|
||||
*/
|
||||
#ifndef STA_OS2_MUTEX_HPP
|
||||
#define STA_OS2_MUTEX_HPP
|
||||
|
||||
|
63
include/sta/os2/queue.hpp
Normal file
63
include/sta/os2/queue.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
/**
|
||||
* @brief CMSIS RTOS2 queue implementation.
|
||||
*/
|
||||
#ifndef STA_OS2_QUEUE_HPP
|
||||
#define STA_OS2_QUEUE_HPP
|
||||
|
||||
#include <sta/assert.hpp>
|
||||
|
||||
#include <cmsis_os2.h>
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
template <typename T>
|
||||
class Os2Queue
|
||||
{
|
||||
public:
|
||||
using Message = T;
|
||||
public:
|
||||
Os2Queue(osMessageQueueId_t * handle);
|
||||
|
||||
bool put(const Message & msg, uint32_t timeout = osWaitForever);
|
||||
bool get(Message * outMsg, uint32_t timeout = osWaitForever);
|
||||
|
||||
uint32 available() const;
|
||||
|
||||
private:
|
||||
osMessageQueueId_t * handle_;
|
||||
};
|
||||
} // namespace sta
|
||||
|
||||
|
||||
namespace sta
|
||||
{
|
||||
template <typename T>
|
||||
Os2Queue<T>::Os2Queue(osMessageQueueId_t * handle)
|
||||
: handle_{handle}
|
||||
{
|
||||
STA_ASSERT(handle != nullptr);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool Os2Queue<T>::put(const Message & msg, uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
return (osOK == osMessageQueuePut(*handle_, &msg, 0, timeout));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool Os2Queue<T>::get(Message * outMsg, uint32_t timeout /* = osWaitForever */)
|
||||
{
|
||||
uint8_t prio;
|
||||
return (osOK == osMessageQueueGet(*handle_, outMsg, &prio, timeout));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
uint32 Os2Queue<T>::available() const
|
||||
{
|
||||
return osMessageQueueGetCount(*handle_);
|
||||
}
|
||||
} // namespace sta
|
||||
|
||||
|
||||
#endif // STA_OS2_QUEUE_HPP
|
@@ -1,3 +1,6 @@
|
||||
/**
|
||||
* @brief CMSIS RTOS2 signal implementation.
|
||||
*/
|
||||
#ifndef STA_OS2_SIGNAL_HPP
|
||||
#define STA_OS2_SIGNAL_HPP
|
||||
|
||||
|
Reference in New Issue
Block a user