shared/runtime/softtimer: Generalise soft_timer to work without SysTick.

If a port defines MICROPY_SOFT_TIMER_TICKS_MS then soft_timer assumes a
SysTick back end, and provides a soft_timer_next variable that sets when
the next call to soft_timer_handler() should occur.

Otherwise, a port should provide soft_timer_get_ms() and
soft_timer_schedule_at_ms() with appropriate semantics (see comments).

Existing users of soft_timer should continue to work as they did.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George
2023-11-14 13:19:31 +11:00
parent 9c7067d9ad
commit 516cc280e0
4 changed files with 63 additions and 38 deletions

View File

@@ -35,6 +35,9 @@
#include "hpl_time_measure.h"
#include "sam.h"
#define MICROPY_PY_PENDSV_ENTER uint32_t atomic_state = raise_irq_pri(IRQ_PRI_PENDSV)
#define MICROPY_PY_PENDSV_EXIT restore_irq_pri(atomic_state)
#define MICROPY_HW_USB_CDC_TX_TIMEOUT (500)
extern int mp_interrupt_char;