diff options
author | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-04-19 13:27:51 +0300 |
---|---|---|
committer | Paul Sokolovsky <pfalcon@users.sourceforge.net> | 2017-04-19 13:28:36 +0300 |
commit | 58467709972724ac94f6488fefe6d066bfa1589e (patch) | |
tree | 2c9ce9bf5fb1f467656853de4f07743ae75adb50 /zephyr/modmachine.c | |
parent | 1f3887dc28a7ee1f5671fcc194930fa33a60ece5 (diff) |
zephyr/modmachine: Implement machine.reset().
Diffstat (limited to 'zephyr/modmachine.c')
-rw-r--r-- | zephyr/modmachine.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/zephyr/modmachine.c b/zephyr/modmachine.c index 4013815d1..5909c37d6 100644 --- a/zephyr/modmachine.c +++ b/zephyr/modmachine.c @@ -28,6 +28,7 @@ #include <stdint.h> #include <stdio.h> +#include <misc/reboot.h> #include "py/obj.h" #include "py/runtime.h" @@ -40,7 +41,8 @@ #if MICROPY_PY_MACHINE STATIC mp_obj_t machine_reset(void) { - printf("Warning: %s is not implemented\n", __func__); + sys_reboot(SYS_REBOOT_COLD); + // Won't get here, Zephyr has infiniloop on its side return mp_const_none; } STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset); @@ -53,7 +55,9 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_cause_obj, machine_reset_cause); STATIC const mp_rom_map_elem_t machine_module_globals_table[] = { { MP_ROM_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_umachine) }, + #ifdef CONFIG_REBOOT { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) }, + #endif { MP_ROM_QSTR(MP_QSTR_reset_cause), MP_ROM_PTR(&machine_reset_cause_obj) }, { MP_ROM_QSTR(MP_QSTR_Pin), MP_ROM_PTR(&machine_pin_type) }, |