From 99ed0f25cb1dded94d0774ee3bdb3c08062df51a Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Sat, 29 Oct 2016 13:38:02 +0300 Subject: [PATCH] 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... --- unix/mphalport.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/unix/mphalport.h b/unix/mphalport.h index e440eafd4e..9e232c5609 100644 --- a/unix/mphalport.h +++ b/unix/mphalport.h @@ -34,6 +34,8 @@ void mp_hal_set_interrupt_char(char c); void mp_hal_stdio_mode_raw(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_us(mp_uint_t us) { usleep(us); }