Skip to content
Snippets Groups Projects
Verified Commit dbeec980 authored by rahix's avatar rahix
Browse files

fix(pycardium): Fix delay implementation


Rewrite the delay implementation to be more accurate and properly handle
incoming MicroPython interrupts (See issue #177).

For this, the delay is split into two functions:

- systick_delay_precise(): Delay with microsecond accuracy for delays
      less than 1 ms.
- systick_delay_sleep(): Sleep for a potentially very long time, using
      WFI to put the CPU to sleep.  Whenever the CPU wakes up, this
      function will poll the MicroPython scheduler so it can execute
      pending interrupts.

Ontop, this implementation allows for a future, fast, tick-based
monotonic time implementation (e.g. mp_hal_ticks_ms).

Signed-off-by: default avatarRahix <rahix@rahix.de>
parent d06941b8
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment