Fork of https://developer.mbed.org/users/bscott/code/STM32_USBDevice/
Fork of STM32_USBDevice by
USBWebUSBSerial Class Reference
WebUSB/USBSerial composite device class Handles outputting to standard CDC or WebUSB endpoint depending on mode. More...
#include <USBWebUSBSerial.h>
Inherits USBDevice.
Public Member Functions | |
USBWebUSBSerial (uint16_t vendor_id, uint16_t product_id, uint16_t product_release=0x0001, bool connect_blocking=true) | |
Constructor. | |
int | read (uint8_t *buf, uint16_t size) |
Read up to size bytes from input buffer. | |
uint8_t | available () |
Check the number of bytes available. | |
int | readable () |
Determine if there is a character available to read. | |
int | writeable () |
Determine if there is space available to write a character. | |
bool | writeBuffered (const uint8_t *buf, uint16_t size) |
Write data asynchronously using internal output buffer. | |
template<typename T > | |
void | attach (T *tptr, void(T::*mptr)(void)) |
Attach a member function to call when a packet is received. | |
void | attach (void(*fptr)(void)) |
Attach a callback called when a packet is received. | |
void | attach (void(*fptr)(int baud, int bits, int parity, int stop)) |
Attach a callback to call when serial's settings are changed. |
Detailed Description
WebUSB/USBSerial composite device class Handles outputting to standard CDC or WebUSB endpoint depending on mode.
Definition at line 42 of file USBWebUSBSerial.h.
Constructor & Destructor Documentation
USBWebUSBSerial | ( | uint16_t | vendor_id, |
uint16_t | product_id, | ||
uint16_t | product_release = 0x0001 , |
||
bool | connect_blocking = true |
||
) |
Constructor.
- Parameters:
-
vendor_id Your vendor_id product_id Your product_id product_release Your product_release (default: 0x0001) connect_blocking define if the connection must be blocked if USB not plugged in
Definition at line 108 of file USBWebUSBSerial.cpp.
Member Function Documentation
void attach | ( | T * | tptr, |
void(T::*)(void) | mptr | ||
) |
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
Definition at line 115 of file USBWebUSBSerial.h.
void attach | ( | void(*)(void) | fptr ) |
Attach a callback called when a packet is received.
- Parameters:
-
fptr function pointer
Definition at line 128 of file USBWebUSBSerial.h.
void attach | ( | void(*)(int baud, int bits, int parity, int stop) | fptr ) |
Attach a callback to call when serial's settings are changed.
- Parameters:
-
fptr function pointer
Definition at line 141 of file USBWebUSBSerial.h.
uint8_t available | ( | ) |
Check the number of bytes available.
- Returns:
- the number of bytes available
Definition at line 616 of file USBWebUSBSerial.cpp.
int read | ( | uint8_t * | buf, |
uint16_t | size | ||
) |
Read up to size bytes from input buffer.
- Returns:
- the number of bytes read
Definition at line 520 of file USBWebUSBSerial.cpp.
int readable | ( | ) |
Determine if there is a character available to read.
- Returns:
- 1 if there is a character available to read, 0 otherwise
Definition at line 88 of file USBWebUSBSerial.h.
int writeable | ( | ) |
Determine if there is space available to write a character.
- Returns:
- 1 if there is space to write a character, 0 otherwise
Definition at line 96 of file USBWebUSBSerial.h.
bool writeBuffered | ( | const uint8_t * | buf, |
uint16_t | size | ||
) |
Write data asynchronously using internal output buffer.
- Parameters:
-
buf pointer to data size size of the buffer. The maximum size of data is limited by the size of the internal buffer
- Returns:
- true if successfull
Definition at line 526 of file USBWebUSBSerial.cpp.
Generated on Wed Jul 13 2022 00:18:45 by 1.7.2