A web server for monitoring and controlling a MakerBot Replicator over the USB host and ethernet.

Dependencies:   IAP NTPClient RTC mbed-rtos mbed Socket lwip-sys lwip BurstSPI

Fork of LPC1768_Mini-DK by Frank Vannieuwkerke

Embed: (wiki syntax)

« Back to documentation index

USBHostSerial Class Reference

USBHostSerial Class Reference

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

#include <USBHostSerial.h>

Inherits IUSBEnumerator.

Public Member Functions

 USBHostSerial ()
 Constructor.
bool connected ()
 Check if a virtual serial port is connected.
bool connect ()
 Try to connect a serial device.
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=USBHostSerial::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 25 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 95 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 80 of file USBHostSerial.h.

uint8_t available (  )

Check the number of bytes available.

Returns:
the number of bytes available

Definition at line 168 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 135 of file USBHostSerial.cpp.

bool connect (  )

Try to connect a serial device.

Returns:
true if connection was successful

Definition at line 51 of file USBHostSerial.cpp.

bool connected (  )

Check if a virtual serial port is connected.

Returns:
true if a serial device is connected

Definition at line 46 of file USBHostSerial.cpp.

void format ( int  bits = 8,
Parity  parity = USBHostSerial::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 (USBHostSerial::None, USBHostSerial::Odd, USBHostSerial::Even, USBHostSerial::Mark, USBHostSerial::Space; default = USBHostSerial::None)
stopThe number of stop bits (1 or 2; default = 1)

Definition at line 140 of file USBHostSerial.cpp.