Programme d'utilisation des AX12 avec rajout de l'MX12
Fork of test_carteAToutFaire_PR by
mbed/TimerEvent.h@1:f3f702086a30, 2017-05-11 (annotated)
- Committer:
- ClementBreteau
- Date:
- Thu May 11 11:49:50 2017 +0000
- Revision:
- 1:f3f702086a30
test de la carte ? tout faire du petit robot
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ClementBreteau | 1:f3f702086a30 | 1 | /* mbed Microcontroller Library - TimerEvent |
ClementBreteau | 1:f3f702086a30 | 2 | * Copyright (c) 2007-2009 ARM Limited. All rights reserved. |
ClementBreteau | 1:f3f702086a30 | 3 | */ |
ClementBreteau | 1:f3f702086a30 | 4 | |
ClementBreteau | 1:f3f702086a30 | 5 | #ifndef MBED_TIMEREVENT_H |
ClementBreteau | 1:f3f702086a30 | 6 | #define MBED_TIMEREVENT_H |
ClementBreteau | 1:f3f702086a30 | 7 | |
ClementBreteau | 1:f3f702086a30 | 8 | namespace mbed { |
ClementBreteau | 1:f3f702086a30 | 9 | |
ClementBreteau | 1:f3f702086a30 | 10 | // Base abstraction for timer interrupts |
ClementBreteau | 1:f3f702086a30 | 11 | class TimerEvent { |
ClementBreteau | 1:f3f702086a30 | 12 | |
ClementBreteau | 1:f3f702086a30 | 13 | public: |
ClementBreteau | 1:f3f702086a30 | 14 | |
ClementBreteau | 1:f3f702086a30 | 15 | TimerEvent(); |
ClementBreteau | 1:f3f702086a30 | 16 | |
ClementBreteau | 1:f3f702086a30 | 17 | // The handler registered with the underlying timer interrupt |
ClementBreteau | 1:f3f702086a30 | 18 | static void irq(); |
ClementBreteau | 1:f3f702086a30 | 19 | |
ClementBreteau | 1:f3f702086a30 | 20 | // Destruction removes it... |
ClementBreteau | 1:f3f702086a30 | 21 | virtual ~TimerEvent(); |
ClementBreteau | 1:f3f702086a30 | 22 | |
ClementBreteau | 1:f3f702086a30 | 23 | protected: |
ClementBreteau | 1:f3f702086a30 | 24 | |
ClementBreteau | 1:f3f702086a30 | 25 | // The handler called to service the timer event of the derived class |
ClementBreteau | 1:f3f702086a30 | 26 | virtual void handler() = 0; |
ClementBreteau | 1:f3f702086a30 | 27 | |
ClementBreteau | 1:f3f702086a30 | 28 | // insert in to linked list |
ClementBreteau | 1:f3f702086a30 | 29 | void insert(unsigned int timestamp); |
ClementBreteau | 1:f3f702086a30 | 30 | |
ClementBreteau | 1:f3f702086a30 | 31 | // remove from linked list, if in it |
ClementBreteau | 1:f3f702086a30 | 32 | void remove(); |
ClementBreteau | 1:f3f702086a30 | 33 | |
ClementBreteau | 1:f3f702086a30 | 34 | // Get the current usec timestamp |
ClementBreteau | 1:f3f702086a30 | 35 | static unsigned int timestamp(); |
ClementBreteau | 1:f3f702086a30 | 36 | |
ClementBreteau | 1:f3f702086a30 | 37 | static TimerEvent *_head; // The head of the list of the events, NULL if none |
ClementBreteau | 1:f3f702086a30 | 38 | TimerEvent *_next; // Pointer to the next in the list, NULL if last |
ClementBreteau | 1:f3f702086a30 | 39 | unsigned int _timestamp; // The timestamp at which the even should be triggered |
ClementBreteau | 1:f3f702086a30 | 40 | |
ClementBreteau | 1:f3f702086a30 | 41 | }; |
ClementBreteau | 1:f3f702086a30 | 42 | |
ClementBreteau | 1:f3f702086a30 | 43 | } // namespace mbed |
ClementBreteau | 1:f3f702086a30 | 44 | |
ClementBreteau | 1:f3f702086a30 | 45 | #endif |