Commit Graph

7 Commits

Author SHA1 Message Date
Damien George abe2caf6df py/scheduler: Move clearing of kbd traceback to mp_keyboard_interrupt.
This is a more logical place to clear the KeyboardInterrupt traceback,
right before it is set as a pending exception.  The clearing is also
optimised from a function call to a simple store of NULL.
2020-02-07 16:08:31 +11:00
Damien George 9efb36bfa6 py/scheduler: Move mp_keyboard_interrupt from lib/utils to py core.
This function is tightly coupled to the state and behaviour of the
scheduler, and is a core part of the runtime: to schedule a pending
exception.  So move it there.
2020-02-07 16:08:26 +11:00
Damien George 2459162599 lib/utils/interrupt_char: Invalidate interrupt char at start up.
Otherwise mp_interrupt_char will have a value of zero on start up (because
it's in the BSS) and a KeyboardInterrupt may be raised during start up.
For example this can occur if there is a UART attached to the REPL which
sends spurious null bytes when the device turns on.
2019-05-01 12:41:07 +10:00
Damien George ab954ed513 lib/utils/interrupt_char: Remove support for KBD_EXCEPTION disabled.
If a port is using interrupt_char.c then it must enable
MICROPY_KBD_EXCEPTION.  This is the case for all official ports.
2017-06-02 12:03:57 +10:00
Damien George 6e74d24f30 py: Add micropython.schedule() function and associated runtime code. 2017-03-20 15:20:26 +11:00
Damien George d89cafd5c3 lib/utils/interrupt_char: Use core-provided mp_kbd_exception if enabled.
Ultimately all ports that use lib/utils/interrupt_char would enable
MICROPY_KBD_EXCEPTION, so this is an interim solution.
2016-12-15 13:35:54 +11:00
Paul Sokolovsky 6ab2c5e6cc lib/interrupt_char: Factor out typical Ctrl+C handling from esp8266 port.
Utility functions for keyboard interrupt handling, to be reused across
(baremetal) ports.
2016-09-29 10:15:38 -07:00