45 lines
717 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_API
*/
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);
void acquire() override;
void release() override;
private:
osMutexId_t handle_; /**< CMSIS RTOS2 mutex */
};
} // namespace sta
#endif // STA_RTOS_MUTEX_HPP