summaryrefslogtreecommitdiff
path: root/stmhal/modmachine.c
diff options
context:
space:
mode:
authorTony DiCola <tony@tonydicola.com>2016-10-20 23:01:13 +0000
committerTony DiCola <tony@tonydicola.com>2016-10-20 23:01:13 +0000
commit00a44fa36cd1e35a438c4b89b5cef0bc82787c7a (patch)
tree4800a6984902e043e3fc437adcdfcd665f83e220 /stmhal/modmachine.c
parent1f13f870b8f6554d9cd5570de221a6886e065b64 (diff)
parent3967ca7390ff8257728ef6237b93977b63bde41d (diff)
Merge remote-tracking branch 'micropython/master'
Conflicts: README.md - Kept Adafruit README.md intact. py/emitglue.c - Added xtensa architecture as an OR of the define. zephyr/README.md - Fixed spelling mistake.
Diffstat (limited to 'stmhal/modmachine.c')
-rw-r--r--stmhal/modmachine.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/stmhal/modmachine.c b/stmhal/modmachine.c
index 8bd04f3ec..7a337adb6 100644
--- a/stmhal/modmachine.c
+++ b/stmhal/modmachine.c
@@ -33,6 +33,7 @@
#include "extmod/machine_mem.h"
#include "extmod/machine_pulse.h"
#include "extmod/machine_i2c.h"
+#include "lib/utils/pyexec.h"
#include "lib/fatfs/ff.h"
#include "lib/fatfs/diskio.h"
#include "gccollect.h"
@@ -172,6 +173,12 @@ STATIC mp_obj_t machine_reset(void) {
}
MP_DEFINE_CONST_FUN_OBJ_0(machine_reset_obj, machine_reset);
+STATIC mp_obj_t machine_soft_reset(void) {
+ pyexec_system_exit = PYEXEC_FORCED_EXIT;
+ nlr_raise(mp_obj_new_exception(&mp_type_SystemExit));
+}
+MP_DEFINE_CONST_FUN_OBJ_0(machine_soft_reset_obj, machine_soft_reset);
+
// Activate the bootloader without BOOT* pins.
STATIC NORETURN mp_obj_t machine_bootloader(void) {
pyb_usb_dev_deinit();
@@ -502,6 +509,7 @@ STATIC const mp_map_elem_t machine_module_globals_table[] = {
{ MP_OBJ_NEW_QSTR(MP_QSTR_info), (mp_obj_t)&machine_info_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_unique_id), (mp_obj_t)&machine_unique_id_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_reset), (mp_obj_t)&machine_reset_obj },
+ { MP_OBJ_NEW_QSTR(MP_QSTR_soft_reset), (mp_obj_t)&machine_soft_reset_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_bootloader), (mp_obj_t)&machine_bootloader_obj },
{ MP_OBJ_NEW_QSTR(MP_QSTR_freq), (mp_obj_t)&machine_freq_obj },
#if MICROPY_HW_ENABLE_RNG