Merge pull request #5018 from sandeepmistry/sam-SerialUSB.availableForWrite

SAM: Add Serial_::availableForWrite
This commit is contained in:
Arturo Guadalupi 2016-07-07 18:12:27 +02:00 committed by GitHub
commit e90cf55143
2 changed files with 8 additions and 0 deletions

View File

@ -214,6 +214,13 @@ int Serial_::available(void)
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)
{
ring_buffer *buffer = &cdc_rx_buffer;

View File

@ -54,6 +54,7 @@ public:
void end(void);
virtual int available(void);
virtual int availableForWrite(void);
virtual void accept(void);
virtual int peek(void);
virtual int read(void);