mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-18 07:52:14 +01:00
Add Serial_::availableForWrite().
This makes the CDC "Serial" object on the Leonardo and similar boards support this recently introduced method as well. The CDC code in the sam core is not changed.
This commit is contained in:
parent
9b7b23f045
commit
4f87112c2e
@ -163,6 +163,11 @@ int Serial_::read(void)
|
||||
return USB_Recv(CDC_RX);
|
||||
}
|
||||
|
||||
int Serial_::availableForWrite(void)
|
||||
{
|
||||
return USB_SendSpace(CDC_TX);
|
||||
}
|
||||
|
||||
void Serial_::flush(void)
|
||||
{
|
||||
USB_Flush(CDC_TX);
|
||||
|
@ -92,6 +92,7 @@ public:
|
||||
virtual int available(void);
|
||||
virtual int peek(void);
|
||||
virtual int read(void);
|
||||
int availableForWrite(void);
|
||||
virtual void flush(void);
|
||||
virtual size_t write(uint8_t);
|
||||
virtual size_t write(const uint8_t*, size_t);
|
||||
@ -188,6 +189,7 @@ int USB_SendControl(uint8_t flags, const void* d, int len);
|
||||
int USB_RecvControl(void* d, int len);
|
||||
|
||||
uint8_t USB_Available(uint8_t ep);
|
||||
uint8_t USB_SendSpace(uint8_t ep);
|
||||
int USB_Send(uint8_t ep, const void* data, int len); // blocking
|
||||
int USB_Recv(uint8_t ep, void* data, int len); // non-blocking
|
||||
int USB_Recv(uint8_t ep); // non-blocking
|
||||
|
Loading…
x
Reference in New Issue
Block a user