From 58fc0d17cc2d7c5dfb4ce268b7e43d35eebac342 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Sun, 18 Dec 2011 17:52:35 -0500 Subject: added asynchronous buffering of received CDC characters This fixes the issue Federico reported where bytes written by host but not read by sketch would cause serial connection to lock up. Ring buffer implementation is based on HardwareSerial.cpp. Adds public accept() method to CDC. --- cores/arduino/USBCore.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 398bc73..7924078 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -599,6 +599,8 @@ ISR(USB_GEN_vect) { #ifdef CDC_ENABLED USB_Flush(CDC_TX); // Send a tx frame if found + while (USB_Available(CDC_RX)) // Handle received bytes (if any) + Serial.accept(); #endif // check whether the one-shot period has elapsed. if so, turn off the LED -- cgit v1.2.3-18-g5258 From b407337677f8b6964a69939e0fb5a371dfb0d3e4 Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 7 Mar 2012 16:21:04 +0100 Subject: Fix for some strange behaviours during board reset --- cores/arduino/USBCore.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 7924078..c360d26 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -637,6 +637,12 @@ void USB_::attach() PLLCSR = 0x12; // Need 16 MHz xtal while (!(PLLCSR & (1< Date: Mon, 9 Apr 2012 08:06:35 -0400 Subject: sketch USB VID and PID values are passed in from boards.txt at compile time now. changed sketch PIDs to final values. also uncommented Micro section in boards.txt --- cores/arduino/USBCore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index c360d26..d1aeace 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -51,9 +51,9 @@ const u16 STRING_LANGUAGE[2] = { const u16 STRING_IPRODUCT[17] = { (3<<8) | (2+2*16), -#if USB_PID == USB_PID_LEONARDO +#if USB_PID == 0x8034 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' -#elif USB_PID == USB_PID_MICRO +#elif USB_PID == 0x8035 'A','r','d','u','i','n','o',' ','M','i','c','r','o',' ',' ',' ' #endif }; -- cgit v1.2.3-18-g5258 From e2e0260094c762fddf4669b7a957914405ae9f19 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Mon, 9 Apr 2012 10:12:14 -0400 Subject: Micro I hardly knew ye --- cores/arduino/USBCore.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index d1aeace..34c4372 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -53,14 +53,18 @@ const u16 STRING_IPRODUCT[17] = { (3<<8) | (2+2*16), #if USB_PID == 0x8034 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' -#elif USB_PID == 0x8035 - 'A','r','d','u','i','n','o',' ','M','i','c','r','o',' ',' ',' ' +#else + 'U','S','B',' ','I','O',' ','B','O','A','R','D',' ',' ',' ',' ' #endif }; const u16 STRING_IMANUFACTURER[12] = { (3<<8) | (2+2*11), +#if USB_VID == 0x2341 'A','r','d','u','i','n','o',' ','L','L','C' +#else + 'U','n','k','n','o','w','n',' ',' ',' ',' ' +#endif }; #ifdef CDC_ENABLED -- cgit v1.2.3-18-g5258 From d755d0035d4e3a816c127fd8207722bfe6629eee Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Wed, 25 Apr 2012 15:56:18 -0400 Subject: changed PID values for Leonardo bootloader and sketch done to avoid driver problems for users who installed the pre-release bootloader and driver --- cores/arduino/USBCore.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 34c4372..9e89fd6 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -51,10 +51,10 @@ const u16 STRING_LANGUAGE[2] = { const u16 STRING_IPRODUCT[17] = { (3<<8) | (2+2*16), -#if USB_PID == 0x8034 +#if USB_PID == 0x8036 'A','r','d','u','i','n','o',' ','L','e','o','n','a','r','d','o' #else - 'U','S','B',' ','I','O',' ','B','O','A','R','D',' ',' ',' ',' ' + 'U','S','B',' ','I','O',' ','B','o','a','r','d',' ',' ',' ',' ' #endif }; -- cgit v1.2.3-18-g5258 From 757a77ab67edb9831fe11fe95c80cb08a695e4a1 Mon Sep 17 00:00:00 2001 From: Zach Eveland Date: Tue, 1 May 2012 11:18:15 -0400 Subject: renamed Leonardo USB_ class to USBDevice_ to be unambiguous. renamed "USB" object to "USBDevice" to prevent conflict with USB Host library (thanks Massimo) --- cores/arduino/USBCore.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'cores/arduino/USBCore.cpp') diff --git a/cores/arduino/USBCore.cpp b/cores/arduino/USBCore.cpp index 9e89fd6..6766be6 100644 --- a/cores/arduino/USBCore.cpp +++ b/cores/arduino/USBCore.cpp @@ -627,13 +627,13 @@ u8 USBConnected() //======================================================================= //======================================================================= -USB_ USB; +USBDevice_ USBDevice; -USB_::USB_() +USBDevice_::USBDevice_() { } -void USB_::attach() +void USBDevice_::attach() { _usbConfiguration = 0; UHWCON = 0x01; // power internal reg @@ -654,18 +654,18 @@ void USB_::attach() TX_RX_LED_INIT; } -void USB_::detach() +void USBDevice_::detach() { } // Check for interrupts // TODO: VBUS detection -bool USB_::configured() +bool USBDevice_::configured() { return _usbConfiguration; } -void USB_::poll() +void USBDevice_::poll() { } -- cgit v1.2.3-18-g5258