move reload exception to reload.c

crypto-aes
Roy Hooper 5 years ago
parent 698912633f
commit 92b1cb5743

@ -188,6 +188,7 @@ PY_O_BASENAME = \
objtype.o \
objzip.o \
opmethods.o \
reload.o \
sequence.o \
stream.o \
binary.o \

@ -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
}

@ -0,0 +1,10 @@
//
// Created by Roy Hooper on 2018-05-14.
//
#ifndef CIRCUITPYTHON_RELOAD_H
#define CIRCUITPYTHON_RELOAD_H
void mp_raise_reload_exception(void);
#endif //CIRCUITPYTHON_RELOAD_H

@ -25,6 +25,7 @@
*/
#include "py/obj.h"
#include "py/runtime.h"
#include "py/reload.h"
#include "lib/utils/interrupt_char.h"
#include "supervisor/shared/autoreload.h"
@ -101,13 +102,7 @@ MP_DEFINE_CONST_FUN_OBJ_1(supervisor_set_rgb_status_brightness_obj, supervisor_s
//|
STATIC mp_obj_t supervisor_reload(void) {
reload_requested = true;
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
mp_raise_reload_exception();
return mp_const_none;
}
MP_DEFINE_CONST_FUN_OBJ_0(supervisor_reload_obj, supervisor_reload);

Loading…
Cancel
Save