/** * @file * @brief RTOS event implementation. */ #ifndef STA_RTOS_EVENT_HPP #define STA_RTOS_EVENT_HPP #include #include namespace sta { /** * @brief Implementation of Event using CMSIS RTOS2. * * @ingroup STA_RTOS_SYNC */ class RtosEvent : public Event { public: RtosEvent(); ~RtosEvent(); /** * @brief Set given flags for the event. */ void set(uint32_t flags) override; /** * @brief Clear given flags for the event. */ void clear(uint32_t flags) override; /** * @brief Get current flags for the event. * * @return Current flags. */ uint32_t get() override; /** * @brief Wait for any of the given flags to be set. Clears the flags afterwards * * @param flags Flags to wait for. * @param timeout Timeout in milliseconds. * @return Event flags before clearing or error code if highest bit set. */ uint32_t wait(uint32_t flags, uint32_t timeout = osWaitForever) override; /** * @brief Wait for any of the given flags to be set without clearing the flags afterwards. * * @param flags Flags to wait for. * @param timeout Timeout in milliseconds. * @return Event flags before clearing or error code if highest bit set. */ uint32_t peek(uint32_t flags, uint32_t timeout = osWaitForever) override; private: osEventFlagsId_t event_id; /**< CMSIS RTOS2 Event Flag */ }; } // namespace sta #endif // STA_RTOS_EVENT_HPP