Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: TYBLE16_simple_data_logger TYBLE16_MP3_Air
Timer Class Reference
[Timer class]
A general purpose timer. More...
#include <Timer.h>
Inherits NonCopyable< Timer >.
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 milliseconds. | |
| int | read_us () |
| Get the time passed in microseconds. | |
| operator float () | |
| An operator shorthand for read() | |
| us_timestamp_t | read_high_resolution_us () |
| Get in a high resolution type the time passed in microseconds. | |
Private Member Functions | |
| MBED_DEPRECATED ("Invalid copy construction of a NonCopyable resource.") NonCopyable(const NonCopyable &) | |
| NonCopyable copy constructor. | |
| MBED_DEPRECATED ("Invalid copy assignment of a NonCopyable resource.") NonCopyable &operator | |
| NonCopyable copy assignment operator. | |
Detailed Description
A general purpose timer.
- Note:
- Synchronization level: Interrupt safe
Example:
// Count the time to toggle an 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 54 of file Timer.h.
Member Function Documentation
| float read | ( | void | ) |
| us_timestamp_t read_high_resolution_us | ( | ) |
| int read_ms | ( | ) |
| int read_us | ( | ) |
| void reset | ( | void | ) |
Generated on Tue Jul 12 2022 13:55:42 by
1.7.2