Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of USBHost by
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
| USBHostSerial | ( | ) |
Constructor.
Definition at line 25 of file USBHostSerial.cpp.
Member Function Documentation
| void attach | ( | T * | tptr, |
| void(T::*)(void) | mptr, | ||
| IrqType | irq = RxIrq |
||
| ) |
Attach a member function to call when a packet is received.
- Parameters:
-
tptr pointer to the object to call the member function on mptr pointer to the member function to be called irq irq type
Definition at line 80 of file USBHostSerial.h.
| void attach | ( | void(*)(void) | fn, |
| IrqType | irq = RxIrq |
||
| ) |
Attach a callback called when a packet is received.
- Parameters:
-
ptr function pointer
Definition at line 95 of file USBHostSerial.h.
| uint8_t available | ( | ) |
Check the number of bytes available.
- Returns:
- the number of bytes available
Definition at line 152 of file USBHostSerial.cpp.
| void baud | ( | int | baudrate = 9600 ) |
Set the baud rate of the serial port.
- Parameters:
-
baudrate The baudrate of the serial port (default = 9600).
Definition at line 123 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:
-
bits The number of bits in a word (default = 8) parity The parity used (USBHostSerial::None, USBHostSerial::Odd, USBHostSerial::Even, USBHostSerial::Mark, USBHostSerial::Space; default = USBHostSerial::None) stop The number of stop bits (1 or 2; default = 1)
Definition at line 128 of file USBHostSerial.cpp.
Generated on Fri Jul 15 2022 03:47:32 by
1.7.2
