8000 zephyr/modmachine: Add machine.idle(). · micropython/micropython@40798d8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 40798d8

Browse files
committed
zephyr/modmachine: Add machine.idle().
Signed-off-by: Damien George <damien@micropython.org>
1 parent f514e35 commit 40798d8

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

ports/zephyr/modmachine.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,19 @@ STATIC mp_obj_t machine_reset_cause(void) {
5353
}
5454
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause);
5555

56+
STATIC mp_obj_t machine_idle(void) {
57+
k_yield();
58+
return mp_const_none;
59+
}
60+
STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_idle_obj, machine_idle);
61+
5662
STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
5763
{ MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_umachine) },
5864
#ifdef CONFIG_REBOOT
5965
{ MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
6066
#endif
6167
{ MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) },
68+
{ MP_ROM_QSTR(MP_QSTR_idle), MP_ROM_PTR(&machine_idle_obj) },
6269

6370
#if MICROPY_PY_MACHINE_I2C
6471
{ MP_ROM_QSTR(MP_QSTR_I2C), MP_ROM_PTR(&machine_hard_i2c_type) },

0 commit comments

Comments
 (0)
0