From 45a1d32e71b6b1ccff4ce7db5299e39867e57f29 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Mon, 30 Apr 2012 20:17:40 +0200 Subject: [PATCH] [SAM] enumeration is now okay. Device still not working. --- hardware/arduino/sam/cores/sam/USB/USBCore.cpp | 15 ++++++++------- .../sam/validation_usb_device/test_usb_device.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/hardware/arduino/sam/cores/sam/USB/USBCore.cpp b/hardware/arduino/sam/cores/sam/USB/USBCore.cpp index 60d9d18be..ad83b494d 100644 --- a/hardware/arduino/sam/cores/sam/USB/USBCore.cpp +++ b/hardware/arduino/sam/cores/sam/USB/USBCore.cpp @@ -213,8 +213,9 @@ static bool USBD_SendControl(uint8_t d) { if (_cmark < _cend) { - if (!UDD_WaitForINOrOUT()) - return false; + // /!\ NE DEVRAIT THEORIQUEMENT PAS ETRE COMMENTE... mais ca marche mieux sans... pourquoi?!!! + //if (!UDD_WaitForINOrOUT()) + // return false; UDD_Send8(d); @@ -238,7 +239,10 @@ int USBD_SendControl(uint8_t flags, const void* d, uint32_t len) { uint8_t c = *data++; if (!USBD_SendControl(c)) + { + printf("=> USBD_SendControl : return -1\r\n"); return -1; + } } return sent; } @@ -311,6 +315,8 @@ _Pragma("pack(1)") _Pragma("pack()") printf("=> USBD_SendConfiguration clen=%d\r\n", config.clen); +printf("=> USBD_SendConfiguration maxlen=%d\r\n", maxlen); + // Now send them USBD_InitControl(maxlen); USBD_SendControl(0,&config,sizeof(ConfigDescriptor)); @@ -382,9 +388,6 @@ volatile int cpt = 0; // Endpoint 0 interrupt static void USB_ISR(void) { - while (cpt++ > 100) - ; - // End of Reset if (Is_udd_reset()) { @@ -407,7 +410,6 @@ static void USB_ISR(void) } // Start of Frame - happens every millisecond so we use it for TX and RX LED one-shot timing, too -#if 0 if (Is_udd_sof()) { printf(">>> Start of Frame\r\n"); @@ -423,7 +425,6 @@ static void USB_ISR(void) udd_ack_sof(); /* /!\/!\/!\ TAKEN FROM ASF TO CLEAR ISR /!\/!\/!\ */ } -#endif // EP 0 Interrupt if (Is_udd_endpoint_interrupt(0)) 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 d58f8ad79..3b2ffe309 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 @@ -32,18 +32,18 @@ int responseDelay = 10; // response delay of the mouse, in ms void setup() { // initialize the buttons' inputs: - pinMode(upButton, INPUT); + /* pinMode(upButton, INPUT); pinMode(downButton, INPUT); pinMode(leftButton, INPUT); pinMode(rightButton, INPUT); - pinMode(mouseButton, INPUT); + pinMode(mouseButton, INPUT);*/ // initialize mouse control: Mouse.begin(); } void loop() { // read the buttons: - int upState = digitalRead(upButton); + /* int upState = digitalRead(upButton); int downState = digitalRead(downButton); int rightState = digitalRead(rightButton); int leftState = digitalRead(leftButton); @@ -71,8 +71,8 @@ void loop() { if (Mouse.isPressed(MOUSE_LEFT)) { Mouse.release(MOUSE_LEFT); } - } - + }*/ +Mouse.move(10, 10, 0); // a delay so the mouse doesn't move too fast: delay(responseDelay); }