25 lines
320 B
C++
25 lines
320 B
C++
/// © MiroZ 2024
|
|
|
|
#include "Mutex.h"
|
|
#include <assert.h>
|
|
|
|
|
|
Mutex::Mutex()
|
|
{
|
|
assert(m_mutex = xSemaphoreCreateMutex());
|
|
}
|
|
|
|
Mutex::Mutex(SemaphoreHandle_t mutex)
|
|
{
|
|
m_mutex = mutex;
|
|
}
|
|
|
|
bool Mutex::take(uint32_t ticks)
|
|
{
|
|
return xSemaphoreTake(m_mutex, ticks);
|
|
}
|
|
|
|
bool Mutex::give()
|
|
{
|
|
return xSemaphoreGive(m_mutex);
|
|
} |