aboutsummaryrefslogtreecommitdiffstats
path: root/tmk_core/common/wait.h
diff options
context:
space:
mode:
Diffstat (limited to 'tmk_core/common/wait.h')
-rw-r--r--tmk_core/common/wait.h36
1 files changed, 25 insertions, 11 deletions
diff --git a/tmk_core/common/wait.h b/tmk_core/common/wait.h
index 9aed372b7..cb1f386a6 100644
--- a/tmk_core/common/wait.h
+++ b/tmk_core/common/wait.h
@@ -8,22 +8,36 @@ extern "C" {
#endif
#if defined(__AVR__)
-# include <util/delay.h>
-# define wait_ms(ms) _delay_ms(ms)
-# define wait_us(us) _delay_us(us)
+# include <util/delay.h>
+# define wait_ms(ms) _delay_ms(ms)
+# define wait_us(us) _delay_us(us)
#elif defined PROTOCOL_CHIBIOS
-# include "ch.h"
-# define wait_ms(ms) do { if (ms != 0) { chThdSleepMilliseconds(ms); } else { chThdSleepMicroseconds(1); } } while (0)
-# define wait_us(us) do { if (us != 0) { chThdSleepMicroseconds(us); } else { chThdSleepMicroseconds(1); } } while (0)
+# include "ch.h"
+# define wait_ms(ms) \
+ do { \
+ if (ms != 0) { \
+ chThdSleepMilliseconds(ms); \
+ } else { \
+ chThdSleepMicroseconds(1); \
+ } \
+ } while (0)
+# define wait_us(us) \
+ do { \
+ if (us != 0) { \
+ chThdSleepMicroseconds(us); \
+ } else { \
+ chThdSleepMicroseconds(1); \
+ } \
+ } while (0)
#elif defined PROTOCOL_ARM_ATSAM
-# include "clks.h"
-# define wait_ms(ms) CLK_delay_ms(ms)
-# define wait_us(us) CLK_delay_us(us)
+# include "clks.h"
+# define wait_ms(ms) CLK_delay_ms(ms)
+# define wait_us(us) CLK_delay_us(us)
#elif defined(__arm__)
-# include "wait_api.h"
+# include "wait_api.h"
#else // Unit tests
void wait_ms(uint32_t ms);
-#define wait_us(us) wait_ms(us / 1000)
+# define wait_us(us) wait_ms(us / 1000)
#endif
#ifdef __cplusplus