Revert definition of _asyncio 'ticks()' to 8.0.0-beta2

.. and explain why, because it wasn't clear to past-me.

Actually tested on a pico w :)

Closes: #7136
This commit is contained in:
Jeff Epler 2022-10-27 12:27:12 -05:00
parent baa44a2dba
commit 8a2e9de5a4
No known key found for this signature in database
GPG Key ID: D5BF15AB975AB4DE
1 changed files with 9 additions and 1 deletions

View File

@ -73,10 +73,18 @@ STATIC mp_obj_t task_getiter(mp_obj_t self_in, mp_obj_iter_buf_t *iter_buf);
#define _TICKS_PERIOD (1lu << 29)
#define _TICKS_MAX (_TICKS_PERIOD - 1)
#define _TICKS_HALFPERIOD (_TICKS_PERIOD >> 1)
#if !CIRCUITPY || (defined(__unix__) || defined(__APPLE__))
STATIC mp_obj_t ticks(void) {
return MP_OBJ_NEW_SMALL_INT(mp_hal_ticks_ms() & _TICKS_MAX);
}
#else
// We don't share the implementation above because our supervisor_ticks_ms
// starts the epoch about 65 seconds before the first overflow (see
// shared-bindings/supervisor/__init__.c). We assume/require that
// supervisor.ticks_ms is picked as the ticks implementation under
// CircuitPython for the Python-coded bits of asyncio.
#define ticks() MP_OBJ_NEW_SMALL_INT(supervisor_ticks_ms())
#endif
STATIC mp_int_t ticks_diff(mp_obj_t t1_in, mp_obj_t t0_in) {
mp_uint_t t0 = MP_OBJ_SMALL_INT_VALUE(t0_in);