Skip to content

Commit 230c6df

Browse files
committed
correct availableForWrite signature
1 parent ebd624c commit 230c6df

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ int Adafruit_USBD_CDC::peek(void)
9797

9898
int Adafruit_USBD_CDC::read(void)
9999
{
100-
return tud_cdc_read_char();
100+
return (int) tud_cdc_read_char();
101101
}
102102

103103
void Adafruit_USBD_CDC::flush(void)
@@ -126,7 +126,7 @@ size_t Adafruit_USBD_CDC::write(const uint8_t *buffer, size_t size)
126126
return size - remain;
127127
}
128128

129-
size_t Adafruit_USBD_CDC::availableForWrite(void)
129+
int Adafruit_USBD_CDC::availableForWrite(void)
130130
{
131131
return tud_cdc_write_available();
132132
}

cores/nRF5/Adafruit_TinyUSB_Core/Adafruit_USBD_CDC.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ class Adafruit_USBD_CDC : public Stream, Adafruit_USBD_Interface
5151
size_t write(const char *buffer, size_t size) {
5252
return write((const uint8_t *)buffer, size);
5353
}
54-
size_t availableForWrite(void);
54+
virtual int availableForWrite(void);
5555
operator bool();
5656
};
5757

cores/nRF5/Adafruit_TinyUSB_Core/tusb_config.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
#define CFG_TUD_MIDI_TX_BUFSIZE 64
7373

7474
// Vendor FIFO size of TX and RX
75-
// If not configured vendor endpoints will not be buffered
7675
#define CFG_TUD_VENDOR_RX_BUFSIZE 64
7776
#define CFG_TUD_VENDOR_TX_BUFSIZE 64
7877

cores/nRF5/Print.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ class Print
5555
return write((const uint8_t *)buffer, size);
5656
}
5757

58+
// default to zero, meaning "a single write may block"
59+
// should be overriden by subclasses with buffering
60+
virtual int availableForWrite() { return 0; }
61+
5862
size_t print(const __FlashStringHelper *);
5963
size_t print(const String &);
6064
size_t print(const char[]);

0 commit comments

Comments
 (0)