Additional constructor for rtos signal

This commit is contained in:
dario 2024-02-07 18:50:13 +01:00
parent c1ee6464df
commit 341f36ef9d
2 changed files with 13 additions and 1 deletions

View File

@ -25,6 +25,8 @@ namespace sta
*/
RtosSignal(osSemaphoreId_t semaphore);
RtosSignal(uint32_t max, uint32_t initial = 0);
/**
* @brief Notify the signal.
*/

View File

@ -1,11 +1,21 @@
#include <sta/rtos/signal.hpp>
#include <sta/debug/assert.hpp>
namespace sta
{
RtosSignal::RtosSignal(osSemaphoreId_t semaphore)
: semaphore_{semaphore}
{}
{
STA_ASSERT(semaphore != NULL);
}
RtosSignal::RtosSignal(uint32_t max, uint32_t initial /* = 0 */)
: semaphore_{osSemaphoreNew(max, initial, NULL)}
{
STA_ASSERT(semaphore_ != NULL);
}
void RtosSignal::notify()
{