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.
This commit is contained in:
Andrew Leech
2019-02-21 05:23:41 +11:00
committed by Damien George
parent 0fb15fc3f4
commit 9d6f70f715
9 changed files with 70 additions and 25 deletions

View File

@@ -74,11 +74,6 @@ uint8_t *usbd_cdc_init(usbd_cdc_state_t *cdc_in) {
cdc->tx_buf_ptr_out_shadow = 0;
cdc->tx_need_empty_packet = 0;
cdc->connect_state = USBD_CDC_CONNECT_STATE_DISCONNECTED;
#if MICROPY_HW_USB_ENABLE_CDC2
cdc->attached_to_repl = &cdc->base == cdc->base.usbd->cdc;
#else
cdc->attached_to_repl = 1;
#endif
// Return the buffer to place the first USB OUT packet
return cdc->rx_packet_buf;