File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3636#ifdef MICROPY_HAL_H
3737#include MICROPY_HAL_H
3838#endif
39+ #if defined(USE_DEVICE_MODE )
40+ #include "irq.h"
41+ #include "usb.h"
42+ #endif
3943#include "readline.h"
4044#include "pyexec.h"
4145#include "genhdr/mpversion.h"
@@ -307,6 +311,20 @@ int pyexec_friendly_repl(void) {
307311
308312 for (;;) {
309313 input_restart :
314+
315+ #if defined(USE_DEVICE_MODE )
316+ if (usb_vcp_is_enabled ()) {
317+ // If the user gets to here and interrupts are disabled then
318+ // they'll never see the prompt, traceback etc. The USB REPL needs
319+ // interrupts to be enabled or no transfers occur. So we try to
320+ // do the user a favor and reenable interrupts.
321+ if (query_irq () == IRQ_STATE_DISABLED ) {
322+ enable_irq (IRQ_STATE_ENABLED );
323+ mp_hal_stdout_tx_str ("PYB: enabling IRQs\r\n" );
324+ }
325+ }
326+ #endif
327+
310328 vstr_reset (& line );
311329 int ret = readline (& line , ">>> " );
312330
You can’t perform that action at this time.
0 commit comments