1
0
mirror of https://github.com/arduino/Arduino.git synced 2025-03-15 12:29:26 +01:00

[SAM] enumeration is now okay. Device still not working.

This commit is contained in:
Thibault RICHARD 2012-04-30 20:17:40 +02:00
parent 8dfa9f8459
commit 45a1d32e71
2 changed files with 13 additions and 12 deletions

View File

@ -213,8 +213,9 @@ static bool USBD_SendControl(uint8_t d)
{ {
if (_cmark < _cend) if (_cmark < _cend)
{ {
if (!UDD_WaitForINOrOUT()) // /!\ NE DEVRAIT THEORIQUEMENT PAS ETRE COMMENTE... mais ca marche mieux sans... pourquoi?!!!
return false; //if (!UDD_WaitForINOrOUT())
// return false;
UDD_Send8(d); UDD_Send8(d);
@ -238,8 +239,11 @@ int USBD_SendControl(uint8_t flags, const void* d, uint32_t len)
{ {
uint8_t c = *data++; uint8_t c = *data++;
if (!USBD_SendControl(c)) if (!USBD_SendControl(c))
{
printf("=> USBD_SendControl : return -1\r\n");
return -1; return -1;
} }
}
return sent; return sent;
} }
@ -311,6 +315,8 @@ _Pragma("pack(1)")
_Pragma("pack()") _Pragma("pack()")
printf("=> USBD_SendConfiguration clen=%d\r\n", config.clen); printf("=> USBD_SendConfiguration clen=%d\r\n", config.clen);
printf("=> USBD_SendConfiguration maxlen=%d\r\n", maxlen);
// Now send them // Now send them
USBD_InitControl(maxlen); USBD_InitControl(maxlen);
USBD_SendControl(0,&config,sizeof(ConfigDescriptor)); USBD_SendControl(0,&config,sizeof(ConfigDescriptor));
@ -382,9 +388,6 @@ volatile int cpt = 0;
// Endpoint 0 interrupt // Endpoint 0 interrupt
static void USB_ISR(void) static void USB_ISR(void)
{ {
while (cpt++ > 100)
;
// End of Reset // End of Reset
if (Is_udd_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 // 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()) if (Is_udd_sof())
{ {
printf(">>> Start of Frame\r\n"); printf(">>> Start of Frame\r\n");
@ -423,7 +425,6 @@ static void USB_ISR(void)
udd_ack_sof(); /* /!\/!\/!\ TAKEN FROM ASF TO CLEAR ISR /!\/!\/!\ */ udd_ack_sof(); /* /!\/!\/!\ TAKEN FROM ASF TO CLEAR ISR /!\/!\/!\ */
} }
#endif
// EP 0 Interrupt // EP 0 Interrupt
if (Is_udd_endpoint_interrupt(0)) if (Is_udd_endpoint_interrupt(0))

View File

@ -32,18 +32,18 @@ int responseDelay = 10; // response delay of the mouse, in ms
void setup() { void setup() {
// initialize the buttons' inputs: // initialize the buttons' inputs:
pinMode(upButton, INPUT); /* pinMode(upButton, INPUT);
pinMode(downButton, INPUT); pinMode(downButton, INPUT);
pinMode(leftButton, INPUT); pinMode(leftButton, INPUT);
pinMode(rightButton, INPUT); pinMode(rightButton, INPUT);
pinMode(mouseButton, INPUT); pinMode(mouseButton, INPUT);*/
// initialize mouse control: // initialize mouse control:
Mouse.begin(); Mouse.begin();
} }
void loop() { void loop() {
// read the buttons: // read the buttons:
int upState = digitalRead(upButton); /* int upState = digitalRead(upButton);
int downState = digitalRead(downButton); int downState = digitalRead(downButton);
int rightState = digitalRead(rightButton); int rightState = digitalRead(rightButton);
int leftState = digitalRead(leftButton); int leftState = digitalRead(leftButton);
@ -71,8 +71,8 @@ void loop() {
if (Mouse.isPressed(MOUSE_LEFT)) { if (Mouse.isPressed(MOUSE_LEFT)) {
Mouse.release(MOUSE_LEFT); Mouse.release(MOUSE_LEFT);
} }
} }*/
Mouse.move(10, 10, 0);
// a delay so the mouse doesn't move too fast: // a delay so the mouse doesn't move too fast:
delay(responseDelay); delay(responseDelay);
} }