USB CDC (Virtual COM Port) interface.
Static class providing serial I/O over USB CDC. All operations are non-blocking unless noted.
- Note
- read/available/connected are ISR-safe (TinyUSB buffer ops). write/puts/write_byte are NOT ISR-safe — may call tud_task(). flush() is NOT ISR-safe — blocks until TX complete.
Definition at line 39 of file cdc.hpp.
|
| static size_t | write (const uint8_t *data, size_t len) |
| | Write data to USB serial (non-blocking)
|
| |
| static size_t | puts (const char *str) |
| | Write null-terminated string.
|
| |
| static bool | write_byte (uint8_t byte) |
| | Write single byte.
|
| |
| static size_t | read (uint8_t *data, size_t max_len) |
| | Read data from USB serial (non-blocking)
|
| |
| static int | read_byte () |
| | Read single byte.
|
| |
| static size_t | available () |
| | Get number of bytes available to read.
|
| |
| static bool | connected () |
| | Check if host has terminal connected (DTR set)
|
| |
| static bool | just_connected () |
| | Check if a terminal just connected (DTR rising edge)
|
| |
| static void | flush () |
| | Flush TX buffer.
|
| |
| bool sbl::usb::CdcSerial::just_connected |
( |
| ) |
|
|
static |
Check if a terminal just connected (DTR rising edge)
Returns true exactly once per DTR low→high transition. Use this to send boot banners or one-time status messages when a terminal opens the port.
- Returns
- true once per new connection
Definition at line 100 of file cdc.cpp.
References sbl::usb::ready(), s_dtr_rose, and s_last_ready.