summaryrefslogtreecommitdiff
path: root/py/reload.c
diff options
context:
space:
mode:
authorScott Shawcroft <scott@tannewt.org>2018-05-16 17:52:16 -0400
committerGitHub <noreply@github.com>2018-05-16 17:52:16 -0400
commit6a8db03ade64bd2fdf5c7b5df54ad113a062e005 (patch)
treeea667ec04968450be04b68188cba2a45b7bcee17 /py/reload.c
parent07c0a3227da24ef92e44a2457f94af71cc7f081c (diff)
parent918d30cb97c8d15ad27c6a59f68c55dc211b425a (diff)
Merge pull request #838 from rhooper/master
add supervisor.reload() to soft reboot from code
Diffstat (limited to 'py/reload.c')
-rw-r--r--py/reload.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/py/reload.c b/py/reload.c
new file mode 100644
index 000000000..95305f2c9
--- /dev/null
+++ b/py/reload.c
@@ -0,0 +1,16 @@
+//
+// Created by Roy Hooper on 2018-05-14.
+//
+
+#include "reload.h"
+#include "py/mpstate.h"
+
+void mp_raise_reload_exception(void) {
+ MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception));
+#if MICROPY_ENABLE_SCHEDULER
+ if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
+ MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
+ }
+#endif
+
+}