circuitpython: ESP8266: time module missing sleep_us and sleep_ms

A lot of my drivers use time.sleep_ms() and time.sleep_us() for accurate timing, however, CircuitPython on the ESP8266 seems to be missing those.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 15 (5 by maintainers)

Commits related to this issue

Most upvoted comments

Ah, I was wrong, I thought they are regular python objects. Thanks, that solves all the issues.

I think I can have a separate utime.py module, with sleep_ms and sleep_us functions implemented in terms of time.sleep(). Then I can just tell users to put that module on their boards together with my drivers if they are using CircuitPython. This seems like the best solution for this problem so far. Those functions still can’t be used inside interrupt handlers (because they allocate memory to create the floats) and they will introduce additional delays (both for the function call and for creating the float), but it will mostly work.