From 736b90c6028ffad04d5f2a17654254ec2591afe5 Mon Sep 17 00:00:00 2001 From: dario Date: Wed, 19 Jun 2024 15:06:10 +0200 Subject: [PATCH] Added timeout to event wait --- include/sta/rtos/event.hpp | 3 ++- src/event.cpp | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/sta/rtos/event.hpp b/include/sta/rtos/event.hpp index b058e0c..b1288a1 100644 --- a/include/sta/rtos/event.hpp +++ b/include/sta/rtos/event.hpp @@ -48,9 +48,10 @@ namespace sta */ uint32_t wait(uint32_t flags, uint32_t timeout = osWaitForever) override; + uint32_t waitAll(uint32_t flags, uint32_t timeout = osWaitForever) override; private: osEventFlagsId_t event_id; /**< CMSIS RTOS2 Event Flag */ }; } // namespace sta -#endif // STA_RTOS_EVENT_HPP \ No newline at end of file +#endif // STA_RTOS_EVENT_HPP diff --git a/src/event.cpp b/src/event.cpp index c6795cd..bcaff5f 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -22,8 +22,13 @@ namespace sta { return osEventFlagsGet(event_id); } - uint32_t RtosEvent::wait(uint32_t flags, uint32_t timeout) { + uint32_t RtosEvent::wait(uint32_t flags, uint32_t timeout /* = osWaitForever */) { return osEventFlagsWait(event_id, flags, osFlagsWaitAny, timeout); } -} // namespace sta \ No newline at end of file + uint32_t RtosEvent::waitAll(uint32_t flags, uint32_t timeout /* = osWaitForever */) + { + return osEventFlagsWait(event_id, flags, osFlagsWaitAll, timeout); + } + +} // namespace sta