Renesas GR-PEACH OpenCV Development / gr-peach-opencv-project-sd-card_update

Fork of gr-peach-opencv-project-sd-card by the do

Embed: (wiki syntax)

« Back to documentation index

Timer Class Reference

Timer Class Reference
[Drivers]

A general purpose timer. More...

#include <Timer.h>

Inherited by LowPowerTimer.

Public Member Functions

void start ()
 Start the timer.
void stop ()
 Stop the timer.
void reset ()
 Reset the timer to 0.
float read ()
 Get the time passed in seconds.
int read_ms ()
 Get the time passed in mili-seconds.
int read_us ()
 Get the time passed in micro-seconds.
 operator float ()
 An operator shorthand for read()
us_timestamp_t read_high_resolution_us ()
 Get in a high resolution type the time passed in micro-seconds.

Detailed Description

A general purpose timer.

Note:
Synchronization level: Interrupt safe

Example:

 // Count the time to toggle a LED

 #include "mbed.h"

 Timer timer;
 DigitalOut led(LED1);
 int begin, end;

 int main() {
     timer.start();
     begin = timer.read_us();
     led = !led;
     end = timer.read_us();
     printf("Toggle the led takes %d us", end - begin);
 }

Definition at line 49 of file Timer.h.


Member Function Documentation

operator float (  )

An operator shorthand for read()

Definition at line 83 of file Timer.cpp.

float read ( void   )

Get the time passed in seconds.

Definition at line 51 of file Timer.cpp.

us_timestamp_t read_high_resolution_us (  )

Get in a high resolution type the time passed in micro-seconds.

Definition at line 59 of file Timer.cpp.

int read_ms (  )

Get the time passed in mili-seconds.

Definition at line 55 of file Timer.cpp.

int read_us (  )

Get the time passed in micro-seconds.

Definition at line 47 of file Timer.cpp.

void reset (  )

Reset the timer to 0.

If it was already counting, it will continue

Definition at line 76 of file Timer.cpp.

void start ( void   )

Start the timer.

Definition at line 31 of file Timer.cpp.

void stop ( void   )

Stop the timer.

Definition at line 40 of file Timer.cpp.