38 #ifndef SEMAPHORE_CPP_H 39 #define SEMAPHORE_CPP_H 46 #if FREERTOSCPP_USE_NAMESPACE 84 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) 85 sema = xSemaphoreCreateBinaryStatic(&semaBuffer);
87 sema = xSemaphoreCreateBinary();
89 #if configQUEUE_REGISTRY_SIZE > 0 91 vQueueAddToRegistry(
sema, name);
106 return xSemaphoreGive(
sema);
114 bool take(TickType_t delay = portMAX_DELAY)
override {
115 return xSemaphoreTake(
sema, delay);
118 return xSemaphoreTakeFromISR(
sema, &waswoken);
121 #if FREERTOSCPP_USE_CHRONO 138 return xSemaphoreGiveFromISR(
sema, &waswoken);
143 #if __cplusplus < 201101L 149 #endif // __cplusplus 151 #if( configSUPPORT_STATIC_ALLOCATION == 1 ) 152 StaticSemaphore_t semaBuffer;
158 #if FREERTOSCPP_USE_NAMESPACE void operator=(BinarySemaphore const &)=delete
We are not assignable.
bool take(Time_ms delay)
Take the semaphore.
Definition: SemaphoreCPP.h:127
bool take_ISR(portBASE_TYPE &waswoken)
Definition: SemaphoreCPP.h:117
constexpr TickType_t ms2ticks(Time_ms ms)
Definition: FreeRTOScpp.h:81
std::chrono::milliseconds Time_ms
Definition: FreeRTOScpp.h:79
BinarySemaphore(char const *name=nullptr)
Constructor.
Definition: SemaphoreCPP.h:83
Binary Semaphore Wrapper.
Definition: SemaphoreCPP.h:77
bool take(TickType_t delay=portMAX_DELAY) override
Take the semaphore.
Definition: SemaphoreCPP.h:114
Definition: CallBack.h:63
~BinarySemaphore()
Destructor.
Definition: SemaphoreCPP.h:99
A Base class to provide block based locking capability.
Definition: Lock.h:58
BinarySemaphore Semaphore[[deprecated("Rename to BinarySemaphore")]]
Definition: SemaphoreCPP.h:157
bool give_ISR(portBASE_TYPE &waswoken)
Give the Semaphore inside an ISR.
Definition: SemaphoreCPP.h:137
SemaphoreHandle_t sema
Definition: SemaphoreCPP.h:141
bool give() override
Give the Semaphore.
Definition: SemaphoreCPP.h:105