summaryrefslogtreecommitdiffstatshomepage
path: root/py/obj.h
diff options
context:
space:
mode:
authorDave Hylands <dhylands@gmail.com>2014-07-01 23:46:53 -0700
committerDave Hylands <dhylands@gmail.com>2014-07-25 14:00:06 -0700
commit5b7fd20fea6d4329bb3ab45f63df41f46f242688 (patch)
tree10f806ab0d883bc6c087cc22b55b787adbdcf815 /py/obj.h
parent05c255f039b5c0fbdcb0754748fd5d36135acfd9 (diff)
downloadmicropython-5b7fd20fea6d4329bb3ab45f63df41f46f242688.tar.gz
micropython-5b7fd20fea6d4329bb3ab45f63df41f46f242688.zip
Add support for storing args during an exception raised by an irq.
The user code should call micropython.alloc_emergency_exception_buf(size) where size is the size of the buffer used to print the argument passed to the exception. With the test code from #732, and a call to micropython.alloc_emergenncy_exception_buf(100) the following error is now printed: ```python >>> import heartbeat_irq Uncaught exception in Timer(4) interrupt handler Traceback (most recent call last): File "0://heartbeat_irq.py", line 14, in heartbeat_cb NameError: name 'led' is not defined ```
Diffstat (limited to 'py/obj.h')
-rw-r--r--py/obj.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/py/obj.h b/py/obj.h
index d0284e6d21..5f347a2674 100644
--- a/py/obj.h
+++ b/py/obj.h
@@ -453,6 +453,8 @@ void mp_obj_exception_add_traceback(mp_obj_t self_in, qstr file, mp_uint_t line,
void mp_obj_exception_get_traceback(mp_obj_t self_in, mp_uint_t *n, mp_uint_t **values);
mp_obj_t mp_obj_exception_get_value(mp_obj_t self_in);
mp_obj_t mp_obj_exception_make_new(mp_obj_t type_in, uint n_args, uint n_kw, const mp_obj_t *args);
+mp_obj_t mp_alloc_emergency_exception_buf(mp_obj_t size_in);
+void mp_init_emergency_exception_buf(void);
// str
mp_obj_t mp_obj_str_builder_start(const mp_obj_type_t *type, uint len, byte **data);