fsfw/osal/FreeRTOS/Mutex.h

28 lines
679 B
C
Raw Normal View History

2020-05-29 14:02:14 +02:00
#ifndef FRAMEWORK_FREERTOS_MUTEX_H_
#define FRAMEWORK_FREERTOS_MUTEX_H_
2018-07-13 15:56:37 +02:00
#include <framework/ipc/MutexIF.h>
2020-05-29 14:02:14 +02:00
#include <freertos/FreeRTOS.h>
#include <freertos/semphr.h>
2018-07-13 15:56:37 +02:00
2020-05-29 14:02:14 +02:00
/**
* @brief OS component to implement MUTual EXclusion
*
* @details
* Mutexes are binary semaphores which include a priority inheritance mechanism.
* Documentation: https://www.freertos.org/Real-time-embedded-RTOS-mutexes.html
* @ingroup osal
*/
2018-07-13 15:56:37 +02:00
class Mutex : public MutexIF {
public:
Mutex();
~Mutex();
2020-06-04 20:12:37 +02:00
ReturnValue_t lockMutex(uint32_t timeoutMs = MutexIF::BLOCKING) override;
2020-05-29 14:02:14 +02:00
ReturnValue_t unlockMutex() override;
2018-07-13 15:56:37 +02:00
private:
SemaphoreHandle_t handle;
};
2020-05-29 14:02:14 +02:00
#endif /* FRAMEWORK_FREERTOS_MUTEX_H_ */