From 6e74d24f30bca3fb70876b1fb9a6b3a59850b83c Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 16 Feb 2017 18:05:06 +1100 Subject: py: Add micropython.schedule() function and associated runtime code. --- py/runtime.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'py/runtime.h') diff --git a/py/runtime.h b/py/runtime.h index 954833b67a..d4b1fa79a6 100644 --- a/py/runtime.h +++ b/py/runtime.h @@ -64,6 +64,16 @@ extern const qstr mp_binary_op_method_name[]; void mp_init(void); void mp_deinit(void); +void mp_handle_pending(void); +void mp_handle_pending_tail(mp_uint_t atomic_state); + +#if MICROPY_ENABLE_SCHEDULER +void mp_sched_lock(void); +void mp_sched_unlock(void); +static inline unsigned int mp_sched_num_pending(void) { return MP_STATE_VM(sched_sp); } +bool mp_sched_schedule(mp_obj_t function, mp_obj_t arg); +#endif + // extra printing method specifically for mp_obj_t's which are integral type int mp_print_mp_int(const mp_print_t *print, mp_obj_t x, int base, int base_char, int flags, char fill, int width, int prec); -- cgit v1.2.3