Lab 1 Program C
Fork of mbed by
Diff: TimerEvent.h
- Revision:
- 9:cf0d45ce28a6
- Parent:
- 4:5d1359a283bc
- Child:
- 11:1c1ebd0324fa
--- a/TimerEvent.h Tue Feb 03 18:02:02 2009 +0000 +++ b/TimerEvent.h Wed Apr 15 14:15:04 2009 +0000 @@ -1,43 +1,43 @@ -/* mbed Microcontroller Library - TimerEvent - * Copyright (c) 2007-2008, sford - */ - -#ifndef MBED_TIMEREVENT_H -#define MBED_TIMEREVENT_H - -namespace mbed { - -// Base abstraction for timer interrupts -class TimerEvent { - -public: - - // The handler registered with the underlying timer interrupt - static void irq(); - - // Destruction removes it... - virtual ~TimerEvent(); - -protected: - - // The handler called to service the timer event of the derived class - virtual void handler() = 0; - - // insert in to linked list - void insert(unsigned int timestamp); - - // remove from linked list, if in it - void remove(); - - // Get the current usec timestamp - static unsigned int timestamp(); - - static TimerEvent *_head; // The head of the list of the events, NULL if none - TimerEvent *_next; // Pointer to the next in the list, NULL if last - unsigned int _timestamp; // The timestamp at which the even should be triggered - -}; - -} - -#endif +/* mbed Microcontroller Library - TimerEvent + * Copyright (c) 2007-2008, sford + */ + +#ifndef MBED_TIMEREVENT_H +#define MBED_TIMEREVENT_H + +namespace mbed { + +// Base abstraction for timer interrupts +class TimerEvent { + +public: + + // The handler registered with the underlying timer interrupt + static void irq(); + + // Destruction removes it... + virtual ~TimerEvent(); + +protected: + + // The handler called to service the timer event of the derived class + virtual void handler() = 0; + + // insert in to linked list + void insert(unsigned int timestamp); + + // remove from linked list, if in it + void remove(); + + // Get the current usec timestamp + static unsigned int timestamp(); + + static TimerEvent *_head; // The head of the list of the events, NULL if none + TimerEvent *_next; // Pointer to the next in the list, NULL if last + unsigned int _timestamp; // The timestamp at which the even should be triggered + +}; + +} + +#endif