unix/mphalport.h: Add warning of mp_hal_delay_ms() implementation.

It's implemented in terms of usleep(), and POSIX doesn't guarantee that
usleep() can sleep for more than a second. This restriction unlikely
applies to any real-world system, but...
This commit is contained in:
Paul Sokolovsky 2016-10-29 13:38:02 +03:00
parent 6ed5583f8c
commit 99ed0f25cb

View File

@ -34,6 +34,8 @@ void mp_hal_set_interrupt_char(char c);
void mp_hal_stdio_mode_raw(void); void mp_hal_stdio_mode_raw(void);
void mp_hal_stdio_mode_orig(void); void mp_hal_stdio_mode_orig(void);
// TODO: POSIX et al. define usleep() as guaranteedly capable only of 1s sleep:
// "The useconds argument shall be less than one million."
static inline void mp_hal_delay_ms(mp_uint_t ms) { usleep((ms) * 1000); } static inline void mp_hal_delay_ms(mp_uint_t ms) { usleep((ms) * 1000); }
static inline void mp_hal_delay_us(mp_uint_t us) { usleep(us); } static inline void mp_hal_delay_us(mp_uint_t us) { usleep(us); }