Skip to content
Snippets Groups Projects

Implement proper delays for Pycardium

Merged rahix requested to merge rahix/proper-sleep into master

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

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).


Fixes #177 (closed).

Cc: @Woazboat

Edited by rahix

Merge request reports

Merge request pipeline #4233 passed

Merge request pipeline passed for dbeec980

Merged by rahixrahix 5 years ago (Nov 13, 2019 11:30am UTC)

Loading

Pipeline #4234 passed

Pipeline passed for 3c1645ce on master

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
  • Loading
Please register or sign in to reply
Loading