Fork of the USBHost library by mbed.

Dependencies:   FATFileSystem mbed-rtos

Fork of USBHost by mbed official

Embed: (wiki syntax)

« Back to documentation index

USBHostSerialPort Class Reference

USBHostSerialPort Class Reference

A class to communicate a USB virtual serial port. More...

#include <USBHostSerial.h>

Inherited by USBHostSerial.

Public Member Functions

 USBHostSerialPort ()
 Constructor.
uint8_t available ()
 Check the number of bytes available.
template<typename T >
void attach (T *tptr, void(T::*mptr)(void), IrqType irq=RxIrq)
 Attach a member function to call when a packet is received.
void attach (void(*fn)(void), IrqType irq=RxIrq)
 Attach a callback called when a packet is received.
void baud (int baudrate=9600)
 Set the baud rate of the serial port.
void format (int bits=8, Parity parity=USBHostSerialPort::None, int stop_bits=1)
 Set the transmission format used by the Serial port.

Detailed Description

A class to communicate a USB virtual serial port.

Definition at line 31 of file USBHostSerial.h.


Constructor & Destructor Documentation

Constructor.

Definition at line 214 of file USBHostSerial.cpp.


Member Function Documentation

void attach ( void(*)(void)  fn,
IrqType  irq = RxIrq 
)

Attach a callback called when a packet is received.

Parameters:
ptrfunction pointer

Definition at line 84 of file USBHostSerial.h.

void attach ( T *  tptr,
void(T::*)(void)  mptr,
IrqType  irq = RxIrq 
)

Attach a member function to call when a packet is received.

Parameters:
tptrpointer to the object to call the member function on
mptrpointer to the member function to be called
irqirq type

Definition at line 69 of file USBHostSerial.h.

uint8_t available (  )

Check the number of bytes available.

Returns:
the number of bytes available

Definition at line 339 of file USBHostSerial.cpp.

void baud ( int  baudrate = 9600 )

Set the baud rate of the serial port.

Parameters:
baudrateThe baudrate of the serial port (default = 9600).

Definition at line 285 of file USBHostSerial.cpp.

void format ( int  bits = 8,
Parity  parity = USBHostSerialPort::None,
int  stop_bits = 1 
)

Set the transmission format used by the Serial port.

Parameters:
bitsThe number of bits in a word (default = 8)
parityThe parity used (USBHostSerialPort::None, USBHostSerialPort::Odd, USBHostSerialPort::Even, USBHostSerialPort::Mark, USBHostSerialPort::Space; default = USBHostSerialPort::None)
stopThe number of stop bits (1 or 2; default = 1)

Definition at line 290 of file USBHostSerial.cpp.