From 53b583d56e7da75560413a2387bfebff89e6902a Mon Sep 17 00:00:00 2001 From: "@CarlWachter" Date: Tue, 12 Sep 2023 13:40:39 +0200 Subject: [PATCH 1/2] Added Events --- include/sta/event.hpp | 47 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 include/sta/event.hpp diff --git a/include/sta/event.hpp b/include/sta/event.hpp new file mode 100644 index 0000000..dce0b9e --- /dev/null +++ b/include/sta/event.hpp @@ -0,0 +1,47 @@ +/** + * @file + * @brief Event interface definition. + */ +#ifndef STA_CORE_EVENT_HPP +#define STA_CORE_EVENT_HPP + + +namespace sta +{ + /** + * @brief Interface for event objects. + * + * @ingroup sta_core + */ + class Event + { + public: + /** + * @brief Set event flag. + * + * @param Flag nr. to set + */ + virtual void set(uint32_t flags) = 0; + /** + * @brief Clear event flag. + * + * @param Flag nr. to clear + */ + virtual void clear(uint32_t flags) = 0; + /** + * @brief Check event flag state w/o changing it. + * + * @return Value of event flag + */ + virtual uint32_t get() = 0; + /** + * @brief Wait until event flag is set. Timeout default to forever. + * + * @param Event flag nr. to wait for. + */ + virtual uint32_t wait(uint32_t flags, uint32_t timeout = osWaitForever) = 0; + }; +} // namespace sta + + +#endif //STA_CORE_EVENT_HPP From 751435d9467ca8d5ae5f63e50e4238724dcf877b Mon Sep 17 00:00:00 2001 From: "@CarlWachter" Date: Tue, 12 Sep 2023 14:27:40 +0200 Subject: [PATCH 2/2] Timer support added --- include/sta/timer.hpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 include/sta/timer.hpp diff --git a/include/sta/timer.hpp b/include/sta/timer.hpp new file mode 100644 index 0000000..f8c8a72 --- /dev/null +++ b/include/sta/timer.hpp @@ -0,0 +1,34 @@ +/** + * @file + * @brief Timer interface definition. + */ +#ifndef STA_CORE_TIMER_HPP +#define STA_CORE_TIMER_HPP + + +namespace sta +{ + /** + * @brief Interface for timer objects. + * + * @ingroup sta_core + */ + class Timer + { + public: + /** + * @brief Start Timer. + * + * @param time in milliseconds + */ + virtual void start(uint32_t millis) = 0; + /** + * @brief Stop Timer. + * + */ + virtual void stop() = 0; + }; +} // namespace sta + + +#endif //STA_CORE_TIMER_HPP \ No newline at end of file