SD card interface
mbed-export/TimerEvent.h@0:22612ae617a0, 2012-10-08 (annotated)
- Committer:
- lharoon
- Date:
- Mon Oct 08 11:14:07 2012 +0000
- Revision:
- 0:22612ae617a0
1st edition
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lharoon | 0:22612ae617a0 | 1 | /* mbed Microcontroller Library - TimerEvent |
lharoon | 0:22612ae617a0 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
lharoon | 0:22612ae617a0 | 3 | */ |
lharoon | 0:22612ae617a0 | 4 | |
lharoon | 0:22612ae617a0 | 5 | #ifndef MBED_TIMEREVENT_H |
lharoon | 0:22612ae617a0 | 6 | #define MBED_TIMEREVENT_H |
lharoon | 0:22612ae617a0 | 7 | |
lharoon | 0:22612ae617a0 | 8 | namespace mbed { |
lharoon | 0:22612ae617a0 | 9 | |
lharoon | 0:22612ae617a0 | 10 | // Base abstraction for timer interrupts |
lharoon | 0:22612ae617a0 | 11 | class TimerEvent { |
lharoon | 0:22612ae617a0 | 12 | |
lharoon | 0:22612ae617a0 | 13 | public: |
lharoon | 0:22612ae617a0 | 14 | |
lharoon | 0:22612ae617a0 | 15 | TimerEvent(); |
lharoon | 0:22612ae617a0 | 16 | |
lharoon | 0:22612ae617a0 | 17 | // The handler registered with the underlying timer interrupt |
lharoon | 0:22612ae617a0 | 18 | static void irq(); |
lharoon | 0:22612ae617a0 | 19 | |
lharoon | 0:22612ae617a0 | 20 | // Destruction removes it... |
lharoon | 0:22612ae617a0 | 21 | virtual ~TimerEvent(); |
lharoon | 0:22612ae617a0 | 22 | |
lharoon | 0:22612ae617a0 | 23 | protected: |
lharoon | 0:22612ae617a0 | 24 | |
lharoon | 0:22612ae617a0 | 25 | // The handler called to service the timer event of the derived class |
lharoon | 0:22612ae617a0 | 26 | virtual void handler() = 0; |
lharoon | 0:22612ae617a0 | 27 | |
lharoon | 0:22612ae617a0 | 28 | // insert in to linked list |
lharoon | 0:22612ae617a0 | 29 | void insert(unsigned int timestamp); |
lharoon | 0:22612ae617a0 | 30 | |
lharoon | 0:22612ae617a0 | 31 | // remove from linked list, if in it |
lharoon | 0:22612ae617a0 | 32 | void remove(); |
lharoon | 0:22612ae617a0 | 33 | |
lharoon | 0:22612ae617a0 | 34 | // Get the current usec timestamp |
lharoon | 0:22612ae617a0 | 35 | static unsigned int timestamp(); |
lharoon | 0:22612ae617a0 | 36 | |
lharoon | 0:22612ae617a0 | 37 | static TimerEvent *_head; // The head of the list of the events, NULL if none |
lharoon | 0:22612ae617a0 | 38 | TimerEvent *_next; // Pointer to the next in the list, NULL if last |
lharoon | 0:22612ae617a0 | 39 | unsigned int _timestamp; // The timestamp at which the even should be triggered |
lharoon | 0:22612ae617a0 | 40 | |
lharoon | 0:22612ae617a0 | 41 | }; |
lharoon | 0:22612ae617a0 | 42 | |
lharoon | 0:22612ae617a0 | 43 | } // namespace mbed |
lharoon | 0:22612ae617a0 | 44 | |
lharoon | 0:22612ae617a0 | 45 | #endif |