Add Serial_::availableForWrite

This commit is contained in:
Sandeep Mistry 2016-06-06 10:13:18 -04:00
parent 61323525b7
commit d69c372986
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);