From d6d23c530a292109f1005d932e6b2e152e79d971 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Mon, 7 May 2012 20:12:00 +0200 Subject: [PATCH] [SAM] HID and CDC verified okay on Linux/Mac by Cristian. Fixed OTG clock init issue. CDC is not working correctly under Windows (possible inf issue). --- hardware/arduino/sam/cores/sam/USB/CDC.cpp | 2 - hardware/arduino/sam/cores/sam/USB/USBCore.h | 2 - .../sam/cores/sam/libsam_sam3x8e_gcc_dbg.a | Bin 244918 -> 244890 bytes .../validation_usb_device/test_usb_device.cpp | 87 ++++-------------- .../arduino/sam/system/libsam/source/uotghs.c | 4 +- .../arduino_due_x/libsam_sam3x8e_gcc_rel.a | Bin 75318 -> 75306 bytes 6 files changed, 18 insertions(+), 77 deletions(-) diff --git a/hardware/arduino/sam/cores/sam/USB/CDC.cpp b/hardware/arduino/sam/cores/sam/USB/CDC.cpp index bee073d2d..8992a2e63 100644 --- a/hardware/arduino/sam/cores/sam/USB/CDC.cpp +++ b/hardware/arduino/sam/cores/sam/USB/CDC.cpp @@ -51,9 +51,7 @@ static volatile LineInfo _usbLineInfo = { 57600, 0x00, 0x00, 0x00, 0x00 }; _Pragma("pack(1)") static const CDCDescriptor _cdcInterface = { -#ifdef HID_ENABLED D_IAD(0,2,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,1), -#endif // CDC communication interface D_INTERFACE(CDC_ACM_INTERFACE,1,CDC_COMMUNICATION_INTERFACE_CLASS,CDC_ABSTRACT_CONTROL_MODEL,0), diff --git a/hardware/arduino/sam/cores/sam/USB/USBCore.h b/hardware/arduino/sam/cores/sam/USB/USBCore.h index c21398f77..68b18ff65 100644 --- a/hardware/arduino/sam/cores/sam/USB/USBCore.h +++ b/hardware/arduino/sam/cores/sam/USB/USBCore.h @@ -234,10 +234,8 @@ typedef struct typedef struct { -#ifdef HID_ENABLED // IAD IADDescriptor iad; // Only needed on compound device -#endif // Control InterfaceDescriptor cif; // diff --git a/h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~h=-3c z&mm&_C&`b+v;Di}HIYyCLar9`=sO|(9PpZuvqb~l6Vj)xkpP{v_8aM@xhQkR4XQ=y z!y##gHyZQ_Q`#7tY>AspYY_nafSsor&79S^_jNYKn>Mqv*>H7bm_3fuG(++RUJC3( z&(s5K;!FgI|K6vNls*wmsHZd3XLOWRd|xw1nhaMgBm6PV9BMWw%f=Z*)!LJb>3POz zsg3=!L)2=MMcQi)fVUHeKFLlZMweOEx?a-%s94#Jl&!J(2=mx{pa+iX^xodxjO)R!gXqQu8@_DQYm9&$Ulvfomzf|aycK?8lQU_C_? ztWu6rE|8_jq7 z^Xy-&1_+_q*}vT?%aS`aZuL`BWGJuWI3E~i1N@|L4!~`NK7hX!76TZ(C;9 Jr+eiC-wWk+kNE%q diff --git a/hardware/arduino/sam/cores/sam/validation_usb_device/test_usb_device.cpp b/hardware/arduino/sam/cores/sam/validation_usb_device/test_usb_device.cpp index 4e32153a4..6df7ee14c 100644 --- a/hardware/arduino/sam/cores/sam/validation_usb_device/test_usb_device.cpp +++ b/hardware/arduino/sam/cores/sam/validation_usb_device/test_usb_device.cpp @@ -29,62 +29,20 @@ const int mouseButton = 6; int range = 5; // output range of X or Y movement; affects movement speed int responseDelay = 10; // response delay of the mouse, in ms +/* +void setup() { + Mouse.begin(); +} -//void setup() { - // initialize the buttons' inputs: - /* pinMode(upButton, INPUT); - pinMode(downButton, INPUT); - pinMode(leftButton, INPUT); - pinMode(rightButton, INPUT); - pinMode(mouseButton, INPUT);*/ - // initialize mouse control: - // Mouse.begin(); -//} - -//void loop() { - // read the buttons: - /* int upState = digitalRead(upButton); - int downState = digitalRead(downButton); - int rightState = digitalRead(rightButton); - int leftState = digitalRead(leftButton); - int clickState = digitalRead(mouseButton); - - // calculate the movement distance based on the button states: - int xDistance = (leftState - rightState)*range; - int yDistance = (upState - downState)*range; - - // if X or Y is non-zero, move: - if ((xDistance != 0) || (yDistance != 0)) { - Mouse.move(xDistance, yDistance, 0); - } - - // if the mouse button is pressed: - if (clickState == HIGH) { - // if the mouse is not pressed, press it: - if (!Mouse.isPressed(MOUSE_LEFT)) { - Mouse.press(MOUSE_LEFT); - } - } - // else the mouse button is not pressed: - else { - // if the mouse is pressed, release it: - if (Mouse.isPressed(MOUSE_LEFT)) { - Mouse.release(MOUSE_LEFT); - } - }*/ -/*Mouse.move(10, 0, 0); - // a delay so the mouse doesn't move too fast: - delay(1000); -}*/ +void loop() { + Mouse.move(10, 0, 0); + delay(1000); +} +*/ - -//#include "USBAPI.h" - - - -// Cet exemple fonctionne !!! ;-) -/*void setup() { +/* +void setup() { // initialize the digital pin as an output. // Pin 13 has an LED connected on most Arduino boards: //pinMode(13, OUTPUT); @@ -98,34 +56,21 @@ void loop() { //digitalWrite(13, LOW); // set the LED off delay(1000); // wait for a second printf("loop...\r\n"); -}*/ - +} +*/ void setup() { - // open the serial port: -Serial.begin(57600); - // initialize control over the keyboard: -// Keyboard.begin(); + Serial.begin(57600); } void loop() { - // check for incoming serial data: - //if (Serial.available() > 0) { - // read incoming serial data: - //char inChar = Serial.read(); - // Type the next ASCII value from what you received: - // Keyboard.write(inChar+1); - //Serial.print("toto\r\n"); - // check for incoming serial data: - if (Serial.available() > 0) { - // read incoming serial data: + if (Serial.available() > 0) + { char inChar = Serial.read(); - // Type the next ASCII value from what you received: Serial.print(inChar); Serial1.print(inChar); } delay(10); } - diff --git a/hardware/arduino/sam/system/libsam/source/uotghs.c b/hardware/arduino/sam/system/libsam/source/uotghs.c index 276a69015..10d1c9505 100644 --- a/hardware/arduino/sam/system/libsam/source/uotghs.c +++ b/hardware/arduino/sam/system/libsam/source/uotghs.c @@ -75,8 +75,8 @@ uint32_t UDD_Init(void) otg_unfreeze_clock(); // Check USB clock - while (!Is_otg_clock_usable()) - ; + //while (!Is_otg_clock_usable()) + // ; udd_low_speed_disable(); udd_high_speed_disable(); diff --git a/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a b/hardware/arduino/sam/variants/arduino_due_x/libsam_sam3x8e_gcc_rel.a index f090389d0cc0a45dde4ce8456a90f201b7d923f8..ab3148aeb222eaed691bfad2d246b1634731d45c 100644 GIT binary patch delta 888 zcmY+CQAkr!7{|}I-I)%nt*za=DRy0=%lTk<+bn`Mi{gd{Ynpg@8sBGQLNgBJME`F8KX9uB|r|DEqU_ngalu_{ci z3d7Z9N^>9>Xia+`2r!~x0GpMiwsY z)N?D(qE_){&^W7}C$h(ke#$OQ_&B>uuQx9D;d{#X2SK`kl(}n$&nDv&8Ey)tK>b2M zX;$!_8GN8%x&m5`G@kOedm^F2emTqsw6Hp>|IeCFuJ0HpeZnTr5&H29;Wj};*~PaS#e*(rFy$reaX~%b@)pG{2`4G$ zaE(WcAe7E!6M0V^){5LJ+zQ3hM#(BTz^x7uXLPkhDyF8j21ub@;$a;R6XMt_!3NBz z>9_7opBsJ(kj-?}z-#k?8OE6DJY%!ObBw(tUSe#Xc$u+9VwACE413|a@z&_=WU^l9 GGyelxi2q#x delta 962 zcmYk)Ur19?7y$6|ZTH$7S<^f3-O_CSp-nf#sm%?NCM*A>CGp+9Ny9QB%8Ns$&hZ6A`HL3gNy`}zPDsh{c5-9<92V)3V+sv2(iq8I zO8naY-bKowBP$}ESjBCe-zHIYlX{7&n`-JzeJLHHs&aGq=UI_N8ToKXHuDp-?l!*O zBjB;1@(m5N*)Jlrj*Eu{91nU))Brx12{#x)&BJ2&U=h4jm(L)CR7Vhsu-Jjn9E&Fr bnrHD8LQxjI2*t?W61cee=Z5D>;Eehoy22RG