Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit e90cf55

Browse files
authored
Merge pull request #5018 from sandeepmistry/sam-SerialUSB.availableForWrite
SAM: Add Serial_::availableForWrite
2 parents 843ec70 + d69c372 commit e90cf55

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

‎hardware/arduino/sam/cores/arduino/USB/CDC.cpp‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,13 @@ int Serial_::available(void)
214214
return (unsigned int)(CDC_SERIAL_BUFFER_SIZE + buffer->head - buffer->tail) % CDC_SERIAL_BUFFER_SIZE;
215215
}
216216

217+
int Serial_::availableForWrite(void)
218+
{
219+
// return the number of bytes left in the current bank,
220+
// always EP size - 1, because bank is flushed on every write
221+
return (EPX_SIZE - 1);
222+
}
223+
217224
int Serial_::peek(void)
218225
{
219226
ring_buffer *buffer = &cdc_rx_buffer;

‎hardware/arduino/sam/cores/arduino/USB/USBAPI.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class Serial_ : public Stream
5454
void end(void);
5555

5656
virtual int available(void);
57+
virtual int availableForWrite(void);
5758
virtual void accept(void);
5859
virtual int peek(void);
5960
virtual int read(void);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /