1
0
forked from fsfw/fsfw

counting semaph implementation finished

This commit is contained in:
2020-05-27 22:12:52 +02:00
parent 95bf5c1071
commit 63dbf99592
8 changed files with 154 additions and 87 deletions

View File

@ -11,11 +11,39 @@ extern "C" {
class CountingSemaphoreUsingTask: public SemaphoreIF {
public:
CountingSemaphoreUsingTask(uint8_t maxCount, uint8_t initCount);
CountingSemaphoreUsingTask(const uint8_t maxCount, uint8_t initCount);
ReturnValue_t acquire(uint32_t timeoutMs) override;
ReturnValue_t acquire(uint32_t timeoutMs = SemaphoreIF::NO_TIMEOUT) override;
ReturnValue_t release() override;
uint8_t getSemaphoreCounter() const override;
static uint8_t getSemaphoreCounterFromISR(TaskHandle_t task);
/**
* Acquire, using a timeout value in ticks
* @param timeoutTicks
* @return
*/
ReturnValue_t acquireWithTickTimeout(
TickType_t timeoutTicks= SemaphoreIF::NO_TIMEOUT);
/**
* Get handle to the task related to the semaphore.
* @return
*/
TaskHandle_t getTaskHandle();
/**
* Release semaphore of task by supplying task handle
* @param taskToNotify
* @return
*/
static ReturnValue_t release(TaskHandle_t taskToNotify);
/**
* Release seamphore of a task from an ISR.
* @param taskToNotify
* @return
*/
static ReturnValue_t releaseFromISR(TaskHandle_t taskToNotify,
BaseType_t* higherPriorityTaskWoken);
private:
TaskHandle_t handle;