17 #include <hal/Types.h>
18 #include <wpi/mutex.h>
20 #include "frc/ErrorBase.h"
24 using TimerEventHandler = std::function<void()>;
34 explicit Notifier(TimerEventHandler handler);
36 template <
typename Callable,
typename Arg,
typename... Args>
37 Notifier(Callable&& f, Arg&& arg, Args&&... args)
38 :
Notifier(std::bind(std::forward<Callable>(f), std::forward<Arg>(arg),
39 std::forward<Args>(args)...)) {}
47 Notifier& operator=(Notifier&& rhs);
94 void UpdateAlarm(uint64_t triggerTime);
102 std::thread m_thread;
105 wpi::mutex m_processMutex;
108 std::atomic<HAL_NotifierHandle> m_notifier{0};
111 TimerEventHandler m_handler;
114 double m_expirationTime = 0;
120 bool m_periodic =
false;
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
virtual ~Notifier()
Free the resources for a timer event.
Definition: Notifier.h:26
void StartPeriodic(double period)
Register for periodic event notification.
void SetHandler(TimerEventHandler handler)
Change the handler function.
void Stop()
Stop timer events from occuring.
void StartSingle(double delay)
Register for single event notification.
Base class for most objects.
Definition: ErrorBase.h:74
Notifier(TimerEventHandler handler)
Create a Notifier for timer event notification.