mirror of
https://github.com/micropython/micropython.git
synced 2025-12-16 09:50:15 +01:00
rp2: Switch rp2 and drivers to use new event functions.
This commit changes all uses in the rp2 port, and drivers that are optionally supported by that port. The old MICROPY_EVENT_POLL_HOOK and MICROPY_EVENT_POLL_HOOK_FAST macros are no longer used for rp2 builds and are removed (C user code will need to be changed to suit). Also take the opportunity to change some timeouts that used 64-bit arithmetic to 32-bit, to hopefully claw back a little code size. This work was funded through GitHub Sponsors. Signed-off-by: Angus Gratton <angus@redyak.com.au>
This commit is contained in:
committed by
Damien George
parent
df3948d3c2
commit
28529351ae
@@ -249,18 +249,19 @@ extern const struct _mp_obj_type_t mod_network_nic_type_wiznet5k;
|
||||
#define MICROPY_PY_LWIP_REENTER lwip_lock_acquire();
|
||||
#define MICROPY_PY_LWIP_EXIT lwip_lock_release();
|
||||
|
||||
#define MICROPY_EVENT_POLL_HOOK_FAST \
|
||||
do { \
|
||||
extern void mp_handle_pending(bool); \
|
||||
mp_handle_pending(true); \
|
||||
// Port level Wait-for-Event macro
|
||||
//
|
||||
// Do not use this macro directly, include py/runtime.h and
|
||||
// call mp_event_wait_indefinite() or mp_event_wait_ms(timeout)
|
||||
#define MICROPY_INTERNAL_WFE(TIMEOUT_MS) \
|
||||
do { \
|
||||
if ((TIMEOUT_MS) < 0) { \
|
||||
__wfe(); \
|
||||
} else { \
|
||||
best_effort_wfe_or_timeout(make_timeout_time_ms(TIMEOUT_MS)); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
#define MICROPY_EVENT_POLL_HOOK \
|
||||
do { \
|
||||
MICROPY_EVENT_POLL_HOOK_FAST; \
|
||||
__wfe(); \
|
||||
} while (0);
|
||||
|
||||
#define MICROPY_MAKE_POINTER_CALLABLE(p) ((void *)((mp_uint_t)(p) | 1))
|
||||
|
||||
#define MP_SSIZE_MAX (0x7fffffff)
|
||||
|
||||
Reference in New Issue
Block a user