aboutsummaryrefslogtreecommitdiffstats
path: root/wirish/time.h
diff options
context:
space:
mode:
Diffstat (limited to 'wirish/time.h')
-rw-r--r--wirish/time.h36
1 files changed, 33 insertions, 3 deletions
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