From 95783b750fda95f5f4c1fac00ab24da03b31b517 Mon Sep 17 00:00:00 2001 From: Marti Bolivar Date: Mon, 25 Oct 2010 21:15:28 -0400 Subject: arduino language reference nearing completion, properly CC-BY-SA 3.0 attributed --- wirish/time.h | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) (limited to 'wirish/time.h') diff --git a/wirish/time.h b/wirish/time.h index fad47a4..18aef9a 100644 --- a/wirish/time.h +++ b/wirish/time.h @@ -23,7 +23,8 @@ *****************************************************************************/ /** - * @brief Timing and delay functions. + * @file time.h + * @brief Timing and delay functions. */ #ifndef _TIME_H @@ -41,12 +42,20 @@ extern "C"{ extern volatile uint32 systick_timer_millis; -/* time in milliseconds since boot */ +/** + * Returns time (in milliseconds) since the beginning of program + * execution. On overflow, restarts at 0. + * @see micros() + */ static inline uint32 millis(void) { return systick_timer_millis; } -/* Time in microseconds since boot */ +/** + * Returns time (in microseconds) since the beginning of program + * execution. On overflow, restarts at 0. + * @see millis() + */ static inline uint32 micros(void) { uint32 ms; uint32 cycle_cnt; @@ -67,7 +76,28 @@ static inline uint32 micros(void) { return res; } +/** + * Delay for at least the given number of milliseconds. + * + * Interrupts, etc. may cause the actual number of milliseconds to + * exceed ms. However, this function will return no less than ms + * milliseconds from the time it is called. + * + * @param ms the number of milliseconds to delay. + * @see delayMicroseconds() + */ void delay(unsigned long ms); + +/** + * Delay for at least the given number of microseconds. + * + * Interrupts, etc. may cause the actual number of microseconds to + * exceed us. However, this function will return no less than us + * microseconds from the time it is called. + * + * @param us the number of microseconds to delay. + * @see delay() + */ void delayMicroseconds(uint32 us); #ifdef __cplusplus -- cgit v1.2.3