Use the method @zvecr identified to wait more accurately on chibios
This commit is contained in:
parent
51bf3ba3e6
commit
1615d768ea
1 changed files with 3 additions and 16 deletions
|
@ -13,22 +13,9 @@ extern "C" {
|
||||||
# define wait_us(us) _delay_us(us)
|
# define wait_us(us) _delay_us(us)
|
||||||
#elif defined PROTOCOL_CHIBIOS
|
#elif defined PROTOCOL_CHIBIOS
|
||||||
# include "ch.h"
|
# include "ch.h"
|
||||||
# define wait_ms(ms) \
|
// FIXME: This doesn't compile if `NKRO_ENABLED = no`
|
||||||
do { \
|
# define wait_ms(ms) chSysPolledDelayX(MS2RTC(STM32_SYSCLK, x))
|
||||||
if (ms != 0) { \
|
# define wait_us(us) chSysPolledDelayX(US2RTC(STM32_SYSCLK, x))
|
||||||
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
|
#elif defined PROTOCOL_ARM_ATSAM
|
||||||
# include "clks.h"
|
# include "clks.h"
|
||||||
# define wait_ms(ms) CLK_delay_ms(ms)
|
# define wait_ms(ms) CLK_delay_ms(ms)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue