File tree 2 files changed +8
-3
lines changed
hardware/arduino/sam/cores/arduino/USB
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -211,7 +211,7 @@ void Serial_::flush(void)
211
211
USBD_Flush (CDC_TX);
212
212
}
213
213
214
- size_t Serial_::write (uint8_t c )
214
+ size_t Serial_::write (const uint8_t *buffer, size_t size )
215
215
{
216
216
/* only try to send bytes if the high-level CDC connection itself
217
217
is open (not just the pipe) - the OS should set lineState when the port
@@ -224,7 +224,7 @@ size_t Serial_::write(uint8_t c)
224
224
// or locks up, or host virtual serial port hangs)
225
225
if (_usbLineInfo.lineState > 0 )
226
226
{
227
- int r = USBD_Send (CDC_TX,&c, 1 );
227
+ int r = USBD_Send (CDC_TX, buffer, size );
228
228
229
229
if (r > 0 )
230
230
{
@@ -239,6 +239,10 @@ size_t Serial_::write(uint8_t c)
239
239
return 0 ;
240
240
}
241
241
242
+ size_t Serial_::write (uint8_t c) {
243
+ return write (&c, 1 );
244
+ }
245
+
242
246
// This operator is a convenient way for a sketch to check whether the
243
247
// port has actually been configured and opened by the host (as opposed
244
248
// to just being connected to the host). It can be used, for example, in
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ class Serial_ : public Stream
57
57
virtual int read (void );
58
58
virtual void flush (void );
59
59
virtual size_t write (uint8_t );
60
- using Print::write; // pull in write(str) and write(buf, size) from Print
60
+ virtual size_t write (const uint8_t *buffer, size_t size);
61
+ using Print::write; // pull in write(str) from Print
61
62
operator bool ();
62
63
};
63
64
extern Serial_ Serial;
You can’t perform that action at this time.
0 commit comments