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