mbed
Fork of mbed-dev by
Diff: drivers/Timer.h
- Revision:
- 167:e84263d55307
- Parent:
- 149:156823d33999
- Child:
- 168:9672193075cf
diff -r c97ed07ec1a8 -r e84263d55307 drivers/Timer.h --- a/drivers/Timer.h Thu Jun 08 15:02:37 2017 +0100 +++ b/drivers/Timer.h Wed Jun 21 17:46:44 2017 +0100 @@ -21,11 +21,10 @@ namespace mbed { /** \addtogroup drivers */ -/** @{*/ /** A general purpose timer * - * @Note Synchronization level: Interrupt safe + * @note Synchronization level: Interrupt safe * * Example: * @code @@ -45,6 +44,7 @@ * printf("Toggle the led takes %d us", end - begin); * } * @endcode + * @ingroup drivers */ class Timer { @@ -67,14 +67,20 @@ void reset(); /** Get the time passed in seconds + * + * @returns Time passed in seconds */ float read(); - /** Get the time passed in mili-seconds + /** Get the time passed in milli-seconds + * + * @returns Time passed in milli seconds */ int read_ms(); /** Get the time passed in micro-seconds + * + * @returns Time passed in micro seconds */ int read_us(); @@ -82,16 +88,18 @@ */ operator float(); + /** Get in a high resolution type the time passed in micro-seconds. + */ + us_timestamp_t read_high_resolution_us(); + protected: - int slicetime(); - int _running; // whether the timer is running - unsigned int _start; // the start time of the latest slice - int _time; // any accumulated time from previous slices + us_timestamp_t slicetime(); + int _running; // whether the timer is running + us_timestamp_t _start; // the start time of the latest slice + us_timestamp_t _time; // any accumulated time from previous slices const ticker_data_t *_ticker_data; }; } // namespace mbed #endif - -/** @}*/