summaryrefslogtreecommitdiffstatshomepage
path: root/unix/mphalport.h
diff options
context:
space:
mode:
authorPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-29 13:38:02 +0300
committerPaul Sokolovsky <pfalcon@users.sourceforge.net>2016-10-29 13:38:02 +0300
commit99ed0f25cb1dded94d0774ee3bdb3c08062df51a (patch)
treec92f6edef0ad79692c07a9d9bd6f2127f666aed5 /unix/mphalport.h
parent6ed5583f8cfa5aa0afb776654cd996abaaa5fba3 (diff)
downloadmicropython-99ed0f25cb1dded94d0774ee3bdb3c08062df51a.tar.gz
micropython-99ed0f25cb1dded94d0774ee3bdb3c08062df51a.zip
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...
Diffstat (limited to 'unix/mphalport.h')
-rw-r--r--unix/mphalport.h2
1 files changed, 2 insertions, 0 deletions
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); }