Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
Static Public Member Functions | List of all members
sbl::usb::CdcSerial Class Reference

USB CDC (Virtual COM Port) interface. More...

#include <cdc.hpp>

Collaboration diagram for sbl::usb::CdcSerial:

Static Public Member Functions

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 void flush ()
 Flush TX buffer.
 

Detailed Description

USB CDC (Virtual COM Port) interface.

Static class providing serial I/O over USB CDC. All operations are non-blocking unless noted.

Definition at line 33 of file cdc.hpp.

Member Function Documentation

◆ available()

size_t sbl::usb::CdcSerial::available ( )
static

Get number of bytes available to read.

Returns
Bytes available in receive buffer

Definition at line 79 of file cdc.cpp.

◆ connected()

bool sbl::usb::CdcSerial::connected ( )
static

Check if host has terminal connected (DTR set)

Returns
true if host terminal is connected

Definition at line 83 of file cdc.cpp.

◆ flush()

void sbl::usb::CdcSerial::flush ( )
static

Flush TX buffer.

Blocks until all pending data is sent or timeout.

Definition at line 87 of file cdc.cpp.

◆ puts()

size_t sbl::usb::CdcSerial::puts ( const char *  str)
static

Write null-terminated string.

Parameters
strString to write
Returns
Number of bytes written

Definition at line 44 of file cdc.cpp.

References write().

Referenced by sbl::usb::CdcOutput::write().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ read()

size_t sbl::usb::CdcSerial::read ( uint8_t *  data,
size_t  max_len 
)
static

Read data from USB serial (non-blocking)

Parameters
dataBuffer to read into
max_lenMaximum bytes to read
Returns
Number of bytes read

Definition at line 65 of file cdc.cpp.

◆ read_byte()

int sbl::usb::CdcSerial::read_byte ( )
static

Read single byte.

Returns
Byte read, or -1 if none available

Definition at line 72 of file cdc.cpp.

◆ write()

size_t sbl::usb::CdcSerial::write ( const uint8_t *  data,
size_t  len 
)
static

Write data to USB serial (non-blocking)

Parameters
dataPointer to data buffer
lenNumber of bytes to write
Returns
Number of bytes written (may be less than len if buffer full)

Definition at line 13 of file cdc.cpp.

Referenced by puts().

Here is the caller graph for this function:

◆ write_byte()

bool sbl::usb::CdcSerial::write_byte ( uint8_t  byte)
static

Write single byte.

Parameters
byteByte to write
Returns
true if byte was written, false if buffer full

Definition at line 49 of file cdc.cpp.


The documentation for this class was generated from the following files: