Compare commits

...

4 Commits

Author SHA1 Message Date
skullydazed
699e6b229b
Update tmk_core/common/wait.h
Co-Authored-By: Joel Challis <git@zvecr.com>
2019-10-23 13:35:39 -07:00
skullydazed
e180496ab4
Update tmk_core/common/wait.h
Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-10-22 23:57:09 -07:00
skullydazed
e5864cd471
Update tmk_core/common/wait.h
Co-Authored-By: Drashna Jaelre <drashna@live.com>
2019-10-22 23:57:04 -07:00
skullY
1615d768ea Use the method @zvecr identified to wait more accurately on chibios 2019-10-22 23:20:00 -07:00

View File

@ -13,22 +13,10 @@ extern "C" {
# 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 "hal.h"
// FIXME: This doesn't compile if `NKRO_ENABLED = no`
# define wait_ms(ms) chSysPolledDelayX(MS2RTC(STM32_SYSCLK, ms))
# define wait_us(us) chSysPolledDelayX(US2RTC(STM32_SYSCLK, us))
#elif defined PROTOCOL_ARM_ATSAM
# include "clks.h"
# define wait_ms(ms) CLK_delay_ms(ms)