aboutsummaryrefslogtreecommitdiff
path: root/ports/stm32/main.c
diff options
context:
space:
mode:
authorAndrew Leech2019-02-21 05:23:41 +1100
committerDamien George2019-04-01 13:04:05 +1100
commit9d6f70f7154aa01a02d3de1c669241e3a1439218 (patch)
tree315110ddce74aadf6ff0e69dbe40e5ff983676b6 /ports/stm32/main.c
parent0fb15fc3f4b532faa3ca4fe49809f9d9e6c5cd53 (diff)
stm32: Make default USB_VCP stream go through uos.dupterm for main REPL.
Use uos.dupterm for REPL configuration of the main USB_VCP(0) stream on dupterm slot 1, if USB is enabled. This means dupterm can also be used to disable the boot REPL port if desired, via uos.dupterm(None, 1). For efficiency this adds a simple hook to the global uos.dupterm code to work with streams that are known to be native streams.
Diffstat (limited to 'ports/stm32/main.c')
-rw-r--r--ports/stm32/main.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ports/stm32/main.c b/ports/stm32/main.c
index 48b4692bc..c1d27a968 100644
--- a/ports/stm32/main.c
+++ b/ports/stm32/main.c
@@ -630,6 +630,10 @@ soft_reset:
#if MICROPY_HW_ENABLE_USB
pyb_usb_init0();
+
+ // Activate USB_VCP(0) on dupterm slot 1 for the REPL
+ MP_STATE_VM(dupterm_objs[1]) = MP_OBJ_FROM_PTR(&pyb_usb_vcp_obj);
+ usb_vcp_attach_to_repl(&pyb_usb_vcp_obj, true);
#endif
// Initialise the local flash filesystem.