|
46 | 46 |
|
47 | 47 | #include "py/obj.h"
|
48 | 48 | #include "py/runtime.h"
|
| 49 | +#include "lib/utils/pyexec.h" |
49 | 50 | #include "extmod/machine_mem.h"
|
50 | 51 | #include "extmod/machine_signal.h"
|
51 | 52 | #include "extmod/machine_pulse.h"
|
@@ -193,6 +194,12 @@ STATIC mp_obj_t machine_reset(void) {
|
193 | 194 | }
|
194 | 195 | STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
|
195 | 196 |
|
| 197 | +STATIC mp_obj_t machine_soft_reset(void) { |
| 198 | + pyexec_system_exit = PYEXEC_FORCED_EXIT; |
| 199 | + nlr_raise(mp_obj_new_exception(&mp_type_SystemExit)); |
| 200 | +} |
| 201 | +STATIC MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset); |
| 202 |
7A39
+ |
196 | 203 | STATIC mp_obj_t machine_unique_id(void) {
|
197 | 204 | uint8_t chipid[6];
|
198 | 205 | esp_efuse_mac_get_default(chipid);
|
@@ -228,6 +235,7 @@ STATIC const mp_rom_map_elem_t machine_module_globals_table[] = {
|
228 | 235 |
|
229 | 236 | { MP_ROM_QSTR(MP_QSTR_freq), MP_ROM_PTR(&machine_freq_obj) },
|
230 | 237 | { MP_ROM_QSTR(MP_QSTR_reset), MP_ROM_PTR(&machine_reset_obj) },
|
| 238 | + { MP_ROM_QSTR(MP_QSTR_soft_reset), MP_ROM_PTR(&machine_soft_reset_obj) }, |
231 | 239 | { MP_ROM_QSTR(MP_QSTR_unique_id), MP_ROM_PTR(&machine_unique_id_obj) },
|
232 | 240 | { MP_ROM_QSTR(MP_QSTR_sleep), MP_ROM_PTR(&machine_lightsleep_obj) },
|
233 | 241 | { MP_ROM_QSTR(MP_QSTR_lightsleep), MP_ROM_PTR(&machine_lightsleep_obj) },
|
|
0 commit comments