diff options
| author | Damien George <damien@micropython.org> | 2023-11-23 16:36:52 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2023-11-30 16:11:11 +1100 |
| commit | 30a63a204dc6ad02c996d5c40c34b67c85c650e4 (patch) | |
| tree | 464f08a0b2cd65e773daaf93101fdeeee25cfb81 /ports/stm32/modmachine.c | |
| parent | 7d39db2503cab67f03216161b0e829939f80fff7 (diff) | |
extmod/modmachine: Provide common Python bindings for machine.idle().
And use it in all ports. The ports are unchanged, except esp8266 which now
just returns None from this function instead of the time elapsed (to match
other ports), and qemu-arm which gains this function.
Signed-off-by: Damien George <damien@micropython.org>
Diffstat (limited to 'ports/stm32/modmachine.c')
| -rw-r--r-- | ports/stm32/modmachine.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/ports/stm32/modmachine.c b/ports/stm32/modmachine.c index fcdab9dfc..8378fb3fe 100644 --- a/ports/stm32/modmachine.c +++ b/ports/stm32/modmachine.c @@ -102,7 +102,6 @@ { MP_ROM_QSTR(MP_QSTR_bootloader), MP_ROM_PTR(&machine_bootloader_obj) }, \ { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) }, \ MICROPY_PY_MACHINE_RNG_ENTRY \ - { MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) }, \ { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&machine_lightsleep_obj) }, \ { MP_ROM_QSTR(MP_QSTR_lightsleep), MP_ROM_PTR(&machine_lightsleep_obj) }, \ { MP_ROM_QSTR(MP_QSTR_deepsleep), MP_ROM_PTR(&machine_deepsleep_obj) }, \ @@ -381,11 +380,9 @@ MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(machine_freq_obj, 0, 4, machine_freq); // idle() // This executies a wfi machine instruction which reduces power consumption // of the MCU until an interrupt occurs, at which point execution continues. -STATIC mp_obj_t machine_idle(void) { +STATIC void mp_machine_idle(void) { __WFI(); - return mp_const_none; } -MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle); STATIC mp_obj_t machine_lightsleep(size_t n_args, const mp_obj_t *args) { if (n_args != 0) { |
