File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
hardware/arduino/sam/cores/arduino/USB Expand file tree Collapse file tree 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)
211211 USBD_Flush (CDC_TX);
212212}
213213
214- size_t Serial_::write (uint8_t c )
214+ size_t Serial_::write (const uint8_t *buffer, size_t size )
215215{
216216 /* only try to send bytes if the high-level CDC connection itself
217217 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)
224224 // or locks up, or host virtual serial port hangs)
225225 if (_usbLineInfo.lineState > 0 )
226226 {
227- int r = USBD_Send (CDC_TX,&c, 1 );
227+ int r = USBD_Send (CDC_TX, buffer, size );
228228
229229 if (r > 0 )
230230 {
@@ -239,6 +239,10 @@ size_t Serial_::write(uint8_t c)
239239 return 0 ;
240240}
241241
242+ size_t Serial_::write (uint8_t c) {
243+ return write (&c, 1 );
244+ }
245+
242246// This operator is a convenient way for a sketch to check whether the
243247// port has actually been configured and opened by the host (as opposed
244248// 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
5757 virtual int read (void );
5858 virtual void flush (void );
5959 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
6162 operator bool ();
6263};
6364extern Serial_ Serial;
You can’t perform that action at this time.
0 commit comments