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);
102 virtual int _putc(
int c);
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);
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.
void attach(mbed::Callback< void()> &cb)
Attach a Callback called when a packet is received.
Abstract interface to physical USB hardware.
uint8_t available()
Check the number of bytes available.
virtual int _putc(int c)
Send a character.
bool connected()
Check if the terminal is connected.
virtual int _getc()
Read a character: blocking.
int readable()
Determine if there is a character available to read.
int writeable()
Determine if there is space available to write a character.
virtual void lock()
Acquire exclusive access to this instance USBDevice.
virtual void unlock()
Release exclusive access to this instance USBDevice.
USBSerial(bool connect_blocking=true, uint16_t vendor_id=0x1f00, uint16_t product_id=0x2012, uint16_t product_release=0x0001)
Basic constructor.
virtual ~USBSerial()
Destroy this object.
virtual void assert_locked()
Assert that the current thread of execution holds the lock.