22#include "platform/Stream.h"
67 USBSerial(
bool connect_blocking =
true, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
86 USBSerial(
USBPhy *phy, uint16_t vendor_id = 0x1f00, uint16_t product_id = 0x2012, uint16_t product_release = 0x0001);
154 void attach(T *tptr,
void (T::*mptr)(
void))
158 if ((mptr != NULL) && (tptr != NULL)) {
200 void attach(
void (*fptr)(
int baud,
int bits,
int parity,
int stop))
204 _settings_changed_callback = fptr;
210 virtual void data_rx();
211 virtual void line_coding_changed(
int baud,
int bits,
int parity,
int stop)
215 if (_settings_changed_callback) {
216 _settings_changed_callback(baud, bits, parity, stop);
222 void (*_settings_changed_callback)(
int baud,
int bits,
int parity,
int stop);
virtual void lock()
Acquire exclusive access to this instance USBDevice.
virtual void unlock()
Release exclusive access to this instance USBDevice.
virtual void assert_locked()
Assert that the current thread of execution holds the lock.
Abstract interface to physical USB hardware.
virtual ~USBSerial()
Destroy this object.
USBSerial(USBPhy *phy, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001)
Fully featured constructor.
void attach(mbed::Callback< void()> &cb)
Attach a Callback called when a packet is received.
virtual int _getc()
Read a character: blocking.
int readable()
Determine if there is a character available to read.
bool connected()
Check if the terminal is connected.
int writeable()
Determine if there is space available to write a character.
virtual int _putc(int c)
Send a character.
uint8_t available()
Check the number of bytes available.
USBSerial(bool connect_blocking=true, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001)
Basic constructor.
void attach(T *tptr, void(T::*mptr)(void))
Attach a member function to call 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.
void attach(void(*fptr)(void))
Attach a callback called when a packet is received.
Callback class based on template specialization.