diff options
| author | skullY <skullydazed@gmail.com> | 2019-08-30 11:19:03 -0700 |
|---|---|---|
| committer | skullydazed <skullydazed@users.noreply.github.com> | 2019-08-30 15:01:52 -0700 |
| commit | b624f32f944acdc59dcb130674c09090c5c404cb (patch) | |
| tree | bc13adbba137d122d9a2c2fb2fafcbb08ac10e25 /tmk_core/common/wait.h | |
| parent | 61af76a10d00aba185b8338604171de490a13e3b (diff) | |
| download | qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.tar.gz qmk_firmware-b624f32f944acdc59dcb130674c09090c5c404cb.zip | |
clang-format changes
Diffstat (limited to 'tmk_core/common/wait.h')
| -rw-r--r-- | tmk_core/common/wait.h | 36 |
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" { | |||
| 8 | #endif | 8 | #endif |
| 9 | 9 | ||
| 10 | #if defined(__AVR__) | 10 | #if defined(__AVR__) |
| 11 | # include <util/delay.h> | 11 | # include <util/delay.h> |
| 12 | # define wait_ms(ms) _delay_ms(ms) | 12 | # define wait_ms(ms) _delay_ms(ms) |
| 13 | # define wait_us(us) _delay_us(us) | 13 | # define wait_us(us) _delay_us(us) |
| 14 | #elif defined PROTOCOL_CHIBIOS | 14 | #elif defined PROTOCOL_CHIBIOS |
| 15 | # include "ch.h" | 15 | # include "ch.h" |
| 16 | # define wait_ms(ms) do { if (ms != 0) { chThdSleepMilliseconds(ms); } else { chThdSleepMicroseconds(1); } } while (0) | 16 | # define wait_ms(ms) \ |
| 17 | # define wait_us(us) do { if (us != 0) { chThdSleepMicroseconds(us); } else { chThdSleepMicroseconds(1); } } while (0) | 17 | do { \ |
| 18 | if (ms != 0) { \ | ||
| 19 | chThdSleepMilliseconds(ms); \ | ||
| 20 | } else { \ | ||
| 21 | chThdSleepMicroseconds(1); \ | ||
| 22 | } \ | ||
| 23 | } while (0) | ||
| 24 | # define wait_us(us) \ | ||
| 25 | do { \ | ||
| 26 | if (us != 0) { \ | ||
| 27 | chThdSleepMicroseconds(us); \ | ||
| 28 | } else { \ | ||
| 29 | chThdSleepMicroseconds(1); \ | ||
| 30 | } \ | ||
| 31 | } while (0) | ||
| 18 | #elif defined PROTOCOL_ARM_ATSAM | 32 | #elif defined PROTOCOL_ARM_ATSAM |
| 19 | # include "clks.h" | 33 | # include "clks.h" |
| 20 | # define wait_ms(ms) CLK_delay_ms(ms) | 34 | # define wait_ms(ms) CLK_delay_ms(ms) |
| 21 | # define wait_us(us) CLK_delay_us(us) | 35 | # define wait_us(us) CLK_delay_us(us) |
| 22 | #elif defined(__arm__) | 36 | #elif defined(__arm__) |
| 23 | # include "wait_api.h" | 37 | # include "wait_api.h" |
| 24 | #else // Unit tests | 38 | #else // Unit tests |
| 25 | void wait_ms(uint32_t ms); | 39 | void wait_ms(uint32_t ms); |
| 26 | #define wait_us(us) wait_ms(us / 1000) | 40 | # define wait_us(us) wait_ms(us / 1000) |
| 27 | #endif | 41 | #endif |
| 28 | 42 | ||
| 29 | #ifdef __cplusplus | 43 | #ifdef __cplusplus |
