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.
Dependencies: HttpServer_snapshot_mbed-os
USBHostSerialPort Class Reference
A class to communicate a USB virtual serial port. More...
#include <USBHostSerial.h>
Inherited by USBHostSerial.
Public Member Functions | |
| USBHostSerialPort (uint32_t buf_size) | |
| Constructor. | |
| virtual | ~USBHostSerialPort () |
| Destructor. | |
| uint32_t | available () |
| Check the number of bytes available. | |
| template<typename T > | |
| void | attach (T *obj, void(T::*method)(), IrqType type=RxIrq) |
| Attach a member function to call when a packet is received. | |
| void | attach (Callback< void()> func, IrqType type=RxIrq) |
| Attach a function to call whenever a serial interrupt is generated. | |
| 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 32 of file USBHostSerial.h.
Constructor & Destructor Documentation
| USBHostSerialPort | ( | uint32_t | buf_size ) |
Constructor.
Definition at line 210 of file USBHostSerial.cpp.
| ~USBHostSerialPort | ( | ) | [virtual] |
Destructor.
Definition at line 224 of file USBHostSerial.cpp.
Member Function Documentation
| void attach | ( | Callback< void()> | func, |
| IrqType | type = RxIrq |
||
| ) |
Attach a function to call whenever a serial interrupt is generated.
- Parameters:
-
func A pointer to a void function, or 0 to set as none type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
Definition at line 88 of file USBHostSerial.h.
| void attach | ( | T * | obj, |
| void(T::*)() | method, | ||
| IrqType | type = RxIrq |
||
| ) |
Attach a member function to call when a packet is received.
- Parameters:
-
obj pointer to the object to call the member function on method pointer to the member function to be called type Which serial interrupt to attach the member function to (Seriall::RxIrq for receive, TxIrq for transmit buffer empty)
Definition at line 79 of file USBHostSerial.h.
| uint32_t available | ( | ) |
Check the number of bytes available.
- Returns:
- the number of bytes available
| void baud | ( | int | baudrate = 9600 ) |
Set the baud rate of the serial port.
- Parameters:
-
baudrate The baudrate of the serial port (default = 9600).
| void format | ( | int | bits = 8, |
| Parity | parity = USBHostSerialPort::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 (USBHostSerialPort::None, USBHostSerialPort::Odd, USBHostSerialPort::Even, USBHostSerialPort::Mark, USBHostSerialPort::Space; default = USBHostSerialPort::None) stop The number of stop bits (1 or 2; default = 1)
Generated on Wed Jul 13 2022 05:33:38 by
1.7.2