Now you can download a copy of these docs so you can use them offline! Download now
Notifier.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2008. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in $(WIND_BASE)/WPILib. */
5 /*----------------------------------------------------------------------------*/
6 
7 #ifndef NOTIFIER_H
8 #define NOTIFIER_H
9 
10 #include "ChipObject.h"
11 #include "ErrorBase.h"
12 #include "Synchronized.h"
13 
14 typedef void (*TimerEventHandler)(void *param);
15 
16 class Notifier : public ErrorBase
17 {
18 public:
19  Notifier(TimerEventHandler handler, void *param = NULL);
20  virtual ~Notifier();
21  void StartSingle(double delay);
22  void StartPeriodic(double period);
23  void Stop();
24 private:
25  static Notifier *timerQueueHead;
26  static ReentrantSemaphore queueSemaphore;
27  static tAlarm *talarm;
28  static tInterruptManager *manager;
29  static int refcount;
30 
31  static const uint32_t kTimerInterruptNumber = 28;
32  static void ProcessQueue(uint32_t mask, void *params); // process the timer queue on a timer event
33  static void UpdateAlarm(); // update the FPGA alarm since the queue has changed
34  void InsertInQueue(bool reschedule); // insert this Notifier in the timer queue
35  void DeleteFromQueue(); // delete this Notifier from the timer queue
36  TimerEventHandler m_handler; // address of the handler
37  void *m_param; // a parameter to pass to the handler
38  double m_period; // the relative time (either periodic or single)
39  double m_expirationTime; // absolute expiration time for the current event
40  Notifier *m_nextEvent; // next Nofifier event
41  bool m_periodic; // true if this is a periodic event
42  bool m_queued; // indicates if this entry is queued
43  SEM_ID m_handlerSemaphore; // held by interrupt manager task while handler call is in progress
44  DISALLOW_COPY_AND_ASSIGN(Notifier);
45 };
46 
47 #endif
void StartPeriodic(double period)
Definition: Notifier.cpp:249
Notifier(TimerEventHandler handler, void *param=NULL)
Definition: Notifier.cpp:24
void Stop()
Definition: Notifier.cpp:265
void StartSingle(double delay)
Definition: Notifier.cpp:234
virtual ~Notifier()
Definition: Notifier.cpp:57

Generated on Sat Apr 26 2014 12:26:45 for WPILibC++ by doxygen 1.8.6