diff options
Diffstat (limited to 'os/hal/include/hal.h')
-rw-r--r-- | os/hal/include/hal.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/os/hal/include/hal.h b/os/hal/include/hal.h index b7e6141cc..c9a7ad169 100644 --- a/os/hal/include/hal.h +++ b/os/hal/include/hal.h @@ -34,6 +34,7 @@ #include "hal_lld.h"
+#include "tm.h"
#include "pal.h"
#include "adc.h"
#include "can.h"
@@ -43,6 +44,7 @@ #include "icu.h"
#include "mac.h"
#include "pwm.h"
+#include "rtc.h"
#include "serial.h"
#include "sdc.h"
#include "spi.h"
@@ -50,7 +52,6 @@ #include "usb.h"
#include "mmc_spi.h"
#include "serial_usb.h"
-#include "rtc.h"
/*===========================================================================*/
/* Driver constants. */
@@ -188,6 +189,22 @@ (halGetCounterValue() < end))
/** @} */
+/**
+ * @brief Polled delay.
+ * @note The real delays is always few cycles in excess of the specified
+ * value.
+ *
+ * @param[in] ticks number of ticks
+ *
+ * @api
+ */
+#define halPolledDelay(ticks) { \
+ halrtcnt_t start = halGetCounterValue(); \
+ halrtcnt_t timeout = start + (ticks); \
+ while (halIsCounterWithin(start, timeout)) \
+ ; \
+}
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
|