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