strat des robots

Fork of CRAC-Strat_2017 by CRAC Team

Committer:
ClementBreteau
Date:
Fri May 19 17:14:07 2017 +0000
Revision:
17:d1594579eec6
Parent:
0:ad97421fb1fb
strat du robot, 19-05-2017, 19h

Who changed what in which revision?

UserRevisionLine numberNew 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