2024-01-06 17:21:06 +01:00

50 lines
800 B
C++

/**
* @file
* @brief RTOS mutex implementation.
*/
#ifndef STA_RTOS_MUTEX_HPP
#define STA_RTOS_MUTEX_HPP
#include <sta/mutex.hpp>
#include <cmsis_os2.h>
namespace sta
{
/**
* @brief Implementation of Mutex interface using CMSIS RTOS2.
* @ingroup STA_RTOS_SYNC
*/
class RtosMutex : public Mutex
{
public:
/**
* @param handle CMSIS RTOS2 mutex
*/
RtosMutex(osMutexId_t handle);
/**
* @brief Construct a new Rtos Mutex object
*
* @param name The name of the mutex.
*/
RtosMutex(const char* name);
/**
* @brief Acquire the mutex.
*/
void acquire() override;
/**
* @brief Release the mutex.
*/
void release() override;
private:
osMutexId_t handle_; /**< CMSIS RTOS2 mutex */
};
} // namespace sta
#endif // STA_RTOS_MUTEX_HPP