mirror of
https://git.intern.spaceteamaachen.de/ALPAKA/rtos2-utils.git
synced 2025-08-06 11:07:34 +00:00
Added Events wrapper
This commit is contained in:
29
src/event.cpp
Normal file
29
src/event.cpp
Normal file
@@ -0,0 +1,29 @@
|
||||
#include <sta/rtos/event.hpp>
|
||||
|
||||
namespace sta {
|
||||
RtosEvent::RtosEvent() {
|
||||
osEventFlagsAttr_t attr = { 0 };
|
||||
event_id = osEventFlagsNew(&attr);
|
||||
}
|
||||
|
||||
RtosEvent::~RtosEvent() {
|
||||
osEventFlagsDelete(event_id);
|
||||
}
|
||||
|
||||
void RtosEvent::set(uint32_t flags) {
|
||||
osEventFlagsSet(event_id, flags);
|
||||
}
|
||||
|
||||
void RtosEvent::clear(uint32_t flags) {
|
||||
osEventFlagsClear(event_id, flags);
|
||||
}
|
||||
|
||||
uint32_t RtosEvent::get() {
|
||||
return osEventFlagsGet(event_id);
|
||||
}
|
||||
|
||||
uint32_t RtosEvent::wait(uint32_t flags, uint32_t timeout) {
|
||||
return osEventFlagsWait(event_id, flags, osFlagsWaitAny, timeout);
|
||||
}
|
||||
|
||||
} // namespace sta
|
Reference in New Issue
Block a user