mbed libraries for KL25Z

Dependents:   FRDM_RGBLED

Committer:
emilmont
Date:
Wed Oct 10 14:14:12 2012 +0000
Revision:
2:e9a661555b58
Parent:
0:8024c367e29f
Child:
8:c14af7958ef5
Add PWM and I2C implementation;

Who changed what in which revision?

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