1#ifndef SENSESP_SRC_SENSESP_SYSTEM_SEMAPHORE_VALUE_H_
2#define SENSESP_SRC_SENSESP_SYSTEM_SEMAPHORE_VALUE_H_
6#include <freertos/semphr.h>
36 bool wait(T& destination,
unsigned int max_duration_ms) {
37 if (xSemaphoreTake(
semaphore_, max_duration_ms / portTICK_PERIOD_MS) ==
49 bool take(
unsigned int max_duration_ms) {
50 return xSemaphoreTake(
semaphore_, max_duration_ms / portTICK_PERIOD_MS) ==
54 void set(
const T& new_value)
override {
A value container wrapped in a semaphore.
SemaphoreHandle_t semaphore_
bool take(unsigned int max_duration_ms)
Take the semaphore, ignoring the value.
bool wait(T &destination, unsigned int max_duration_ms)
Wait for the value to be updated.
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...