1#ifndef SENSESP_SRC_SENSESP_SYSTEM_SEMAPHORE_VALUE_H_
2#define SENSESP_SRC_SENSESP_SYSTEM_SEMAPHORE_VALUE_H_
6#include <freertos/semphr.h>
37 bool wait(T& destination,
unsigned int max_duration_ms) {
38 if (xSemaphoreTake(
semaphore_, max_duration_ms / portTICK_PERIOD_MS) ==
40 xSemaphoreTake(
mutex_, portMAX_DELAY);
52 bool take(
unsigned int max_duration_ms) {
53 return xSemaphoreTake(
semaphore_, max_duration_ms / portTICK_PERIOD_MS) ==
57 void set(
const T& new_value)
override {
58 xSemaphoreTake(
mutex_, portMAX_DELAY);
SemaphoreHandle_t semaphore_
bool take(unsigned int max_duration_ms)
Take the semaphore, ignoring the value.
StaticSemaphore_t semaphore_buffer_
bool wait(T &destination, unsigned int max_duration_ms)
Wait for the value to be updated.
StaticSemaphore_t mutex_buffer_
void set(const T &new_value) override
A base class for piece of code (like a transform) that accepts data for input. ValueConsumers can acc...