summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--lib/utils/interrupt_char.c9
-rw-r--r--lib/utils/interrupt_char.h1
-rw-r--r--ports/cc3200/telnet/telnet.c3
-rw-r--r--ports/samd/mphalport.c12
-rw-r--r--py/runtime.h1
-rw-r--r--py/scheduler.c11
6 files changed, 14 insertions, 23 deletions
diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c
index 43d45e5aec..3810f7a965 100644
--- a/lib/utils/interrupt_char.c
+++ b/lib/utils/interrupt_char.c
@@ -38,13 +38,4 @@ void mp_hal_set_interrupt_char(int c) {
mp_interrupt_char = c;
}
-void mp_keyboard_interrupt(void) {
- MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
- #if MICROPY_ENABLE_SCHEDULER
- if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
- MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
- }
- #endif
-}
-
#endif
diff --git a/lib/utils/interrupt_char.h b/lib/utils/interrupt_char.h
index ca50d4d567..cb086ead92 100644
--- a/lib/utils/interrupt_char.h
+++ b/lib/utils/interrupt_char.h
@@ -28,6 +28,5 @@
extern int mp_interrupt_char;
void mp_hal_set_interrupt_char(int c);
-void mp_keyboard_interrupt(void);
#endif // MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H
diff --git a/ports/cc3200/telnet/telnet.c b/ports/cc3200/telnet/telnet.c
index dbb77cd6d7..6c4c5cab49 100644
--- a/ports/cc3200/telnet/telnet.c
+++ b/ports/cc3200/telnet/telnet.c
@@ -26,8 +26,7 @@
#include <stdint.h>
-#include "py/mpconfig.h"
-#include "py/obj.h"
+#include "py/runtime.h"
#include "py/mphal.h"
#include "lib/utils/interrupt_char.h"
#include "telnet.h"
diff --git a/ports/samd/mphalport.c b/ports/samd/mphalport.c
index 9f3105c698..49d8976e61 100644
--- a/ports/samd/mphalport.c
+++ b/ports/samd/mphalport.c
@@ -24,9 +24,8 @@
* THE SOFTWARE.
*/
-#include "py/mpstate.h"
+#include "py/runtime.h"
#include "py/mphal.h"
-#include "lib/utils/interrupt_char.h"
#include "samd_soc.h"
#include "tusb.h"
@@ -46,15 +45,6 @@ void mp_hal_set_interrupt_char(int c) {
tud_cdc_set_wanted_char(c);
}
-void mp_keyboard_interrupt(void) {
- MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
- #if MICROPY_ENABLE_SCHEDULER
- if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
- MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
- }
- #endif
-}
-
#endif
void mp_hal_delay_ms(mp_uint_t ms) {
diff --git a/py/runtime.h b/py/runtime.h
index 1c078ae81a..063971883a 100644
--- a/py/runtime.h
+++ b/py/runtime.h
@@ -64,6 +64,7 @@ extern const byte mp_binary_op_method_name[];
void mp_init(void);
void mp_deinit(void);
+void mp_keyboard_interrupt(void);
void mp_handle_pending(bool raise_exc);
void mp_handle_pending_tail(mp_uint_t atomic_state);
diff --git a/py/scheduler.c b/py/scheduler.c
index ff88be9583..250c859831 100644
--- a/py/scheduler.c
+++ b/py/scheduler.c
@@ -28,6 +28,17 @@
#include "py/runtime.h"
+#if MICROPY_KBD_EXCEPTION
+void mp_keyboard_interrupt(void) {
+ MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception));
+ #if MICROPY_ENABLE_SCHEDULER
+ if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
+ MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
+ }
+ #endif
+}
+#endif
+
#if MICROPY_ENABLE_SCHEDULER
#define IDX_MASK(i) ((i) & (MICROPY_SCHEDULER_DEPTH - 1))