1 /* mbed Microcontroller Library - Timer
2 * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
10 #include "PeripheralNames.h"
16 * A general purpose timer
19 * > // Count the time to toggle a LED
24 * > DigitalOut led(LED1);
29 * > begin = timer.read_us();
31 * > end = timer.read_us();
32 * > printf("Toggle the led takes %d us", end - begin);
35 class Timer
: public Base
{
39 Timer(const char *name
= NULL
);
52 * Reset the timer to 0.
54 * If it was already counting, it will continue
59 * Get the time passed in seconds
64 * Get the time passed in mili-seconds
69 * Get the time passed in micro-seconds
78 virtual const struct rpc_method
*get_rpc_methods();
79 static struct rpc_class
*get_rpc_class();
85 int _running
; // whether the timer is running
86 unsigned int _start
; // the start time of the latest slice
87 int _time
; // any accumulated time from previous slices