Improve doxygen comments. Add HAL init

This commit is contained in:
Henrik Stickann
2022-04-24 13:40:11 +02:00
parent ced5f9981f
commit 202c1f3aa6
6 changed files with 82 additions and 8 deletions

View File

@@ -1,3 +1,6 @@
/**
* @brief Constants and macros for use with CMSIS RTOS2.
*/
#ifndef STA_OS2_DEFS_HPP
#define STA_OS2_DEFS_HPP

View File

@@ -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

View File

@@ -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
View 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

View File

@@ -1,3 +1,6 @@
/**
* @brief CMSIS RTOS2 signal implementation.
*/
#ifndef STA_OS2_SIGNAL_HPP
#define STA_OS2_SIGNAL_HPP