...

Dependents:   2doejemplo Labo_TRSE_Drone

Fork of mbed by mbed official

Committer:
rolf.meyer@arm.com
Date:
Fri Aug 28 12:10:11 2009 +0000
Revision:
11:1c1ebd0324fa
Parent:
9:cf0d45ce28a6
Child:
27:7110ebee3484
A shiny new version

Who changed what in which revision?

UserRevisionLine numberNew contents of line
rolf.meyer@arm.com 11:1c1ebd0324fa 1 /* mbed Microcontroller Library - TimerEvent
rolf.meyer@arm.com 11:1c1ebd0324fa 2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
rolf.meyer@arm.com 11:1c1ebd0324fa 3 * sford
rolf.meyer@arm.com 11:1c1ebd0324fa 4 */
rolf.meyer@arm.com 11:1c1ebd0324fa 5
rolf.meyer@arm.com 11:1c1ebd0324fa 6 #ifndef MBED_TIMEREVENT_H
rolf.meyer@arm.com 11:1c1ebd0324fa 7 #define MBED_TIMEREVENT_H
rolf.meyer@arm.com 11:1c1ebd0324fa 8
rolf.meyer@arm.com 11:1c1ebd0324fa 9 namespace mbed {
rolf.meyer@arm.com 11:1c1ebd0324fa 10
rolf.meyer@arm.com 11:1c1ebd0324fa 11 // Base abstraction for timer interrupts
rolf.meyer@arm.com 11:1c1ebd0324fa 12 class TimerEvent {
rolf.meyer@arm.com 11:1c1ebd0324fa 13
rolf.meyer@arm.com 11:1c1ebd0324fa 14 public:
rolf.meyer@arm.com 11:1c1ebd0324fa 15
rolf.meyer@arm.com 11:1c1ebd0324fa 16 TimerEvent();
rolf.meyer@arm.com 11:1c1ebd0324fa 17
rolf.meyer@arm.com 11:1c1ebd0324fa 18 // The handler registered with the underlying timer interrupt
rolf.meyer@arm.com 11:1c1ebd0324fa 19 static void irq();
rolf.meyer@arm.com 11:1c1ebd0324fa 20
rolf.meyer@arm.com 11:1c1ebd0324fa 21 // Destruction removes it...
rolf.meyer@arm.com 11:1c1ebd0324fa 22 virtual ~TimerEvent();
rolf.meyer@arm.com 11:1c1ebd0324fa 23
rolf.meyer@arm.com 11:1c1ebd0324fa 24 protected:
rolf.meyer@arm.com 11:1c1ebd0324fa 25
rolf.meyer@arm.com 11:1c1ebd0324fa 26 // The handler called to service the timer event of the derived class
rolf.meyer@arm.com 11:1c1ebd0324fa 27 virtual void handler() = 0;
rolf.meyer@arm.com 11:1c1ebd0324fa 28
rolf.meyer@arm.com 11:1c1ebd0324fa 29 // insert in to linked list
rolf.meyer@arm.com 11:1c1ebd0324fa 30 void insert(unsigned int timestamp);
rolf.meyer@arm.com 11:1c1ebd0324fa 31
rolf.meyer@arm.com 11:1c1ebd0324fa 32 // remove from linked list, if in it
rolf.meyer@arm.com 11:1c1ebd0324fa 33 void remove();
rolf.meyer@arm.com 11:1c1ebd0324fa 34
rolf.meyer@arm.com 11:1c1ebd0324fa 35 // Get the current usec timestamp
rolf.meyer@arm.com 11:1c1ebd0324fa 36 static unsigned int timestamp();
rolf.meyer@arm.com 11:1c1ebd0324fa 37
rolf.meyer@arm.com 11:1c1ebd0324fa 38 static TimerEvent *_head; // The head of the list of the events, NULL if none
rolf.meyer@arm.com 11:1c1ebd0324fa 39 TimerEvent *_next; // Pointer to the next in the list, NULL if last
rolf.meyer@arm.com 11:1c1ebd0324fa 40 unsigned int _timestamp; // The timestamp at which the even should be triggered
rolf.meyer@arm.com 11:1c1ebd0324fa 41
rolf.meyer@arm.com 11:1c1ebd0324fa 42 };
rolf.meyer@arm.com 11:1c1ebd0324fa 43
rolf.meyer@arm.com 11:1c1ebd0324fa 44 } // namespace mbed
rolf.meyer@arm.com 11:1c1ebd0324fa 45
rolf.meyer@arm.com 11:1c1ebd0324fa 46 #endif