Full Doxygen documentation

This commit is contained in:
@CarlWachter
2024-01-06 16:30:30 +01:00
parent b30d47413b
commit b4b214a756
10 changed files with 137 additions and 111 deletions

View File

@@ -9,12 +9,18 @@
#include <cmsis_os2.h>
#include <sta/event.hpp>
/**
* @defgroup STA_RTOS_EVENT Event
* @ingroup STA_RTOS_API
* @brief CMSIS RTOS2 Event.
*/
namespace sta
{
/**
* @brief Implementation of Event using CMSIS RTOS2.
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_EVENT
*/
class RtosEvent : public Event
{
@@ -22,9 +28,30 @@ namespace sta
RtosEvent();
~RtosEvent();
/**
* @brief Set given flags for the event.
*/
void set(uint32_t flags) override;
/**
* @brief Clear given flags for the event.
*/
void clear(uint32_t flags) override;
/**
* @brief Get current flags for the event.
*
* @return Current flags.
*/
uint32_t get() override;
/**
* @brief Wait for any of the given flags to be set.
*
* @param flags Flags to wait for.
* @param timeout Timeout in milliseconds.
* @return Event flags before clearing or error code if highest bit set.
*/
uint32_t wait(uint32_t flags, uint32_t timeout = osWaitForever) override;
private:

View File

@@ -3,6 +3,11 @@
#include <type_traits>
/**
* @defgroup STA_RTOS_HANDLE Handle
* @ingroup STA_RTOS_API
* @brief Helper for managing access to RTOS handles.
*/
namespace sta
{
@@ -11,7 +16,7 @@ namespace sta
*
* @tparam T CMSIS RTOS2 handle type
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_HANDLE
*/
template <typename T>
class RtosHandle
@@ -27,6 +32,7 @@ namespace sta
*/
struct Deferred
{
/// @brief Handle variable address type
handle_type * pointer;
/**

View File

@@ -9,6 +9,11 @@
#include <cstdint>
/**
* @defgroup STA_RTOS_MEMPOOL MemPool
* @ingroup STA_RTOS_API
* @brief RTOS Memory Pool.
*/
namespace sta
{
@@ -17,7 +22,7 @@ namespace sta
*
* @tparam Message type
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_MEMPOOL
*/
template <typename T>
class RtosMemPool

View File

@@ -9,13 +9,17 @@
#include <cmsis_os2.h>
/**
* @defgroup STA_RTOS_MUTEX Mutex
* @ingroup STA_RTOS_API
* @brief RTOS Mutexes.
*/
namespace sta
{
/**
* @brief Implementation of Mutex interface using CMSIS RTOS2.
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_MUTEX
*/
class RtosMutex : public Mutex
{
@@ -32,7 +36,14 @@ namespace sta
*/
RtosMutex(const char* name);
/**
* @brief Acquire the mutex.
*/
void acquire() override;
/**
* @brief Release the mutex.
*/
void release() override;
private:

View File

@@ -9,6 +9,11 @@
#include <cstdint>
/**
* @defgroup STA_RTOS_QUEUE Queue
* @ingroup STA_RTOS_API
* @brief RTOS Queue.
*/
namespace sta
{
@@ -17,7 +22,7 @@ namespace sta
*
* @tparam Message type
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_QUEUE
*/
template <typename T>
class RtosQueue

View File

@@ -9,6 +9,12 @@
#include <cstdint>
/**
* @defgroup STA_RTOS_SHAREDMEM SharedMem
* @ingroup STA_RTOS_API
* @brief RTOS Shared Memory.
*/
namespace sta
{
@@ -16,8 +22,8 @@ namespace sta
* @brief Interface object for using CMSIS RTOS2 MemPool for one variable.
*
* @tparam Message type
*
* @ingroup STA_RTOS_API
*
* @ingroup STA_RTOS_SHAREDMEM
*/
template <typename T>
class RtosSharedMem

View File

@@ -9,13 +9,19 @@
#include <cmsis_os2.h>
/**
* @defgroup STA_RTOS_SIGNAL Signal
* @ingroup STA_RTOS_API
* @brief RTOS Signal.
*/
namespace sta
{
/**
* @brief Implementation of Signal interface using CMSIS RTOS2.
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_SIGNAL
*
*/
class RtosSignal : public Signal
{
@@ -25,9 +31,28 @@ namespace sta
*/
RtosSignal(osSemaphoreId_t semaphore);
/**
* @brief Notify the signal.
*/
void notify() override;
/**
* @brief Check if the signal is set.
*
* @return true if the signal is set.
*/
bool peek() override;
/**
* @brief Check if the signal is set and clear it.
*
* @return true if the signal was set.
*/
bool test() override;
/**
* @brief Wait for the signal to be set.
*/
void wait() override;
private:

View File

@@ -7,7 +7,13 @@
#include <cmsis_os2.h>
/**
* @defgroup STA_RTOS_THREAD Thread
* @ingroup STA_RTOS_API
* @brief RTOS Thread.
*/
/**
* @ingroup STA_RTOS_THREAD
* @{
*/
@@ -43,11 +49,14 @@
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_BITS UINT32_C( 0x0000000F )
#define STA_RTOS_THREAD_FLAGS_ERROR_CODE_EXT_BITS UINT32_C( 0x7FFFFFF0 )
/**
* @brief Error code from flags.
*/
#define STA_RTOS_THREAD_FLAGS_GET_EXT_ERROR_CODE(flags) (~flags & STA_RTOS_THREAD_FLAGS_ERROR_CODE_EXT_BITS)
/**
* @brief Wait for any of the given flags to be set.
*/
#define STA_RTOS_THREAD_FLAGS_WAIT_ANY(timeout) osThreadFlagsWait(STA_RTOS_THREAD_FLAGS_VALID_BITS, osFlagsWaitAny, timeout)
@@ -59,7 +68,7 @@ namespace sta
/**
* @brief Wrapper for RTOS thread control.
*
* @ingroup STA_RTOS_API
* @ingroup STA_RTOS_THREAD
*/
class RtosThread
{

View File

@@ -18,6 +18,8 @@ namespace sta
* @brief Implementation of Timer using CMSIS RTOS2.
*
* @ingroup STA_RTOS_API
*
* @defgroup STA_RTOS_TIMER Timer
*/
class RtosTimer : public Timer
{