mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
Merge pull request #5018 from sandeepmistry/sam-SerialUSB.availableForWrite
SAM: Add Serial_::availableForWrite
This commit is contained in:
commit
e90cf55143
@ -214,6 +214,13 @@ int Serial_::available(void)
|
|||||||
return (unsigned int)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE;
|
return (unsigned int)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int Serial_::availableForWrite(void)
|
||||||
|
{
|
||||||
|
// return the number of bytes left in the current bank,
|
||||||
|
// always EP size - 1, because bank is flushed on every write
|
||||||
|
return (EPX_SIZE - 1);
|
||||||
|
}
|
||||||
|
|
||||||
int Serial_::peek(void)
|
int Serial_::peek(void)
|
||||||
{
|
{
|
||||||
ring_buffer *buffer = &cdc_rx_buffer;
|
ring_buffer *buffer = &cdc_rx_buffer;
|
||||||
|
@ -54,6 +54,7 @@ public:
|
|||||||
void end(void);
|
void end(void);
|
||||||
|
|
||||||
virtual int available(void);
|
virtual int available(void);
|
||||||
|
virtual int availableForWrite(void);
|
||||||
virtual void accept(void);
|
virtual void accept(void);
|
||||||
virtual int peek(void);
|
virtual int peek(void);
|
||||||
virtual int read(void);
|
virtual int read(void);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user