From 481fdeab797d449f6b82473b1e377c495224cff7 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 30 Aug 2011 11:04:34 -0400 Subject: CDC and HID write() routines now return non-void - brought in line with new write behavior --- cores/arduino/CDC.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'cores/arduino/CDC.cpp') diff --git a/cores/arduino/CDC.cpp b/cores/arduino/CDC.cpp index b04c79b..1f1fcb5 100644 --- a/cores/arduino/CDC.cpp +++ b/cores/arduino/CDC.cpp @@ -153,7 +153,7 @@ void Serial_::flush(void) USB_Flush(CDC_TX); } -void Serial_::write(uint8_t c) +size_t Serial_::write(uint8_t c) { /* only try to send bytes if the high-level CDC connection itself is open (not just the pipe) - the OS should set lineState when the port @@ -164,8 +164,11 @@ void Serial_::write(uint8_t c) // TODO - ZE - check behavior on different OSes and test what happens if an // open connection isn't broken cleanly (cable is yanked out, host dies // or locks up, or host virtual serial port hangs) - if (_usbLineInfo.lineState > 0) + if (_usbLineInfo.lineState > 0) { USB_Send(CDC_TX,&c,1); + return 1; + } + return 0; } Serial_ Serial; -- cgit v1.2.3-18-g5258