streo mp3 player see: http://mbed.org/users/okini3939/notebook/I2S_AUDIO

Dependencies:   FatFileSystemCpp I2SSlave TLV320 mbed

Fork of madplayer by Andreas Grün

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Timer.h Source File

Timer.h

00001 /* mbed Microcontroller Library - Timer
00002  * Copyright (c) 2007-2009 ARM Limited. All rights reserved.
00003  * sford
00004  */ 
00005  
00006 #ifndef MBED_TIMER_H
00007 #define MBED_TIMER_H
00008 
00009 #include "platform.h"
00010 #include "PinNames.h"
00011 #include "PeripheralNames.h"
00012 #include "Base.h"
00013 
00014 namespace mbed {
00015 
00016 /* Class: Timer
00017  *  A general purpose timer 
00018  *
00019  * Example:
00020  * > // Count the time to toggle a LED
00021  * >
00022  * > #include "mbed.h"
00023  * > 
00024  * > Timer timer;
00025  * > DigitalOut led(LED1);
00026  * > int begin, end;
00027  * > 
00028  * > int main() {
00029  * >     timer.start();
00030  * >     begin = timer.read_us();
00031  * >     led = !led;
00032  * >     end = timer.read_us();
00033  * >     printf("Toggle the led takes %d us", end - begin);
00034  * > }
00035  */
00036 class Timer : public Base {
00037 
00038 public:
00039 
00040     Timer(const char *name = NULL);
00041     
00042     /* Function: start
00043      *  Start the timer
00044      */
00045     void start(); 
00046 
00047     /* Function: stop
00048      *  Stop the timer
00049      */
00050     void stop(); 
00051 
00052     /* Function: reset
00053      *  Reset the timer to 0. 
00054      *
00055      * If it was already counting, it will continue
00056      */
00057     void reset();
00058 
00059     /* Function: read
00060      *  Get the time passed in seconds
00061      */
00062     float read();
00063 
00064     /* Function: read_ms
00065      *  Get the time passed in mili-seconds
00066      */
00067     int read_ms();
00068 
00069     /* Function: read_us
00070      *  Get the time passed in micro-seconds
00071      */
00072     int read_us();
00073 
00074 #ifdef MBED_OPERATORS 
00075     operator float();
00076 #endif
00077 
00078 #ifdef MBED_RPC
00079     virtual const struct rpc_method *get_rpc_methods();
00080     static struct rpc_class *get_rpc_class();
00081 #endif
00082 
00083 protected:
00084 
00085     int slicetime();    
00086     int _running;          // whether the timer is running
00087     unsigned int _start;   // the start time of the latest slice
00088     int _time;             // any accumulated time from previous slices
00089     
00090 };
00091 
00092 } // namespace mbed
00093 
00094 #endif
00095