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