From 1ed0e45fc26a016645c91daf3e1c14cef5d477ba Mon Sep 17 00:00:00 2001 From: Noralf Trønnes Date: Thu, 2 Aug 2018 14:52:03 +0200 Subject: Add i2cslave.I2CSlave bindings --- lib/utils/interrupt_char.c | 5 +++++ lib/utils/interrupt_char.h | 3 +++ 2 files changed, 8 insertions(+) (limited to 'lib') diff --git a/lib/utils/interrupt_char.c b/lib/utils/interrupt_char.c index fca0f95b5..91ee5c80e 100644 --- a/lib/utils/interrupt_char.c +++ b/lib/utils/interrupt_char.c @@ -47,4 +47,9 @@ void mp_keyboard_interrupt(void) { #endif } +// Check to see if we've been CTRL-C'ed by autoreload or the user. +bool mp_hal_is_interrupted(void) { + return MP_STATE_VM(mp_pending_exception) == MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_kbd_exception)); +} + #endif diff --git a/lib/utils/interrupt_char.h b/lib/utils/interrupt_char.h index ca50d4d56..e0b1db529 100644 --- a/lib/utils/interrupt_char.h +++ b/lib/utils/interrupt_char.h @@ -26,8 +26,11 @@ #ifndef MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H #define MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H +#include + extern int mp_interrupt_char; void mp_hal_set_interrupt_char(int c); void mp_keyboard_interrupt(void); +bool mp_hal_is_interrupted(void); #endif // MICROPY_INCLUDED_LIB_UTILS_INTERRUPT_CHAR_H -- cgit v1.2.3