/* * threads_timer.hpp * * Created on: Jun 23, 2021 * Author: erki */ #ifndef SKULLC_THREADS_TIMER_HPP_ #define SKULLC_THREADS_TIMER_HPP_ #include #include #include "threads_signal.hpp" extern "C" { struct tmrTimerControl; typedef struct tmrTimerControl* TimerHandle_t; } namespace Threads { struct TimeoutSignal { }; class Timer { public: Timer(Signallable* signal, const char* name, const std::int32_t period_ms, const bool auto_reload = true); ~Timer(); void setAutoReload(const bool auto_reload); void setPeriod(const std::int32_t period_ms); BaseType_t setPeriodFromIsr(const std::int32_t period_ms); bool start(); bool stop(); std::pair startFromIsr(); std::pair stopFromIsr(); private: TimerHandle_t timer_; Signallable* signal_; static void timeoutHandler_(TimerHandle_t timer); }; }// namespace Threads #endif /* SKULLC_THREADS_TIMER_HPP_ */