1
0
forked from fsfw/fsfw

replaced old semaph api

This commit is contained in:
2020-05-27 21:27:31 +02:00
parent 7145982b4a
commit 88e3dc15b2
8 changed files with 48 additions and 35 deletions

View File

@ -1,10 +1,19 @@
#include <framework/osal/FreeRTOS/CountingSemaphUsingTask.h>
#include <framework/osal/FreeRTOS/TaskManagement.h>
#include <framework/serviceinterface/ServiceInterfaceStream.h>
CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(uint8_t count,
uint8_t initCount):
count(count), initCount(initCount) {
CountingSemaphoreUsingTask::CountingSemaphoreUsingTask(uint8_t maxCount,
uint8_t initCount): maxCount(maxCount) {
if(initCount > maxCount) {
sif::error << "CountingSemaphoreUsingTask: Max count bigger than "
"intial cout. Setting initial count to max count." << std::endl;
initCount = maxCount;
}
handle = TaskManagement::getCurrentTaskHandle();
while(currentCount != initCount) {
xTaskNotifyGive(handle);
currentCount++;
}
}
ReturnValue_t CountingSemaphoreUsingTask::acquire(