Support for stdin/stdout over USB serial (CDC) More...

Functions

bool stdio_usb_init (void)
 Explicitly initialize USB stdio and add it to the current set of stdin drivers. More...
 
bool stdio_usb_connected (void)
 Check if there is an active stdio CDC connection to a host. More...
 

Detailed Description

Support for stdin/stdout over USB serial (CDC)

Linking this library or calling pico_enable_stdio_usb(TARGET ENABLED) in the CMake (which achieves the same thing) will add USB CDC to the drivers used for standard input/output

Note this library is a developer convenience. It is not applicable in all cases; for one it takes full control of the USB device precluding your use of the USB in device or host mode. For this reason, this library will automatically disengage if you try to using it alongside tinyusb_device or tinyusb_host. It also takes control of a lower level IRQ and sets up a periodic background task.

This library also includes (by default) functionality to enable the RP2040 to be reset over the USB interface.

Function Documentation

◆ stdio_usb_connected()

bool stdio_usb_connected ( void  )

Check if there is an active stdio CDC connection to a host.

Returns
true if stdio is connected over CDC

◆ stdio_usb_init()

bool stdio_usb_init ( void  )

Explicitly initialize USB stdio and add it to the current set of stdin drivers.

PICO_STDIO_USB_CONNECT_WAIT_TIMEOUT_MS can be set to cause this method to wait for a CDC connection from the host before returning, which is useful if you don't want any initial stdout output to be discarded before the connection is established.

Returns
true if the USB CDC was initialized, false if an error occurred

Copyright (c) 2020 Raspberry Pi (Trading) Ltd.

SPDX-License-Identifier: BSD-3-Clause