@web-font-path: "roboto-debian.css";
v2.2.0 (RP2040)
Loading...
Searching...
No Matches
pico_stdio_usb
pico_stdio

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.
bool | stdio_usb_deinit (void)
| Explicitly deinitialize USB stdio and remove it from the current set of stdin drivers.
bool | stdio_usb_connected (void)
| Check if there is an active stdio CDC connection to a host.
void | stdio_usb_call_chars_available_callback (void)
| Explicitly calls the registered USB stdio chars_available_callback.

## 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 RP-series microcontroller to be reset over the USB interface.

## Function Documentation

## stdio_usb_call_chars_available_callback()

void stdio_usb_call_chars_available_callback | ( | void |  | ) |

Explicitly calls the registered USB stdio chars_available_callback.

This method is normally called by the internal USB stdio background thread when there is new USB CDC data available to read. However, if the internal background thread is disabled (e.g. when the user directly links tinyUSB), the user will need to implement their own background thread and call this method directly.

## 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_deinit()

bool stdio_usb_deinit | ( | void |  | ) |

Explicitly deinitialize USB stdio and remove it from the current set of stdin drivers.

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

## 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