fixed directly connected low-speed device func.

This commit is contained in:
Oleg Mazurov 2013-06-18 18:49:57 -06:00
parent a8bc10f7f5
commit 1c5db85af6

15
Usb.cpp
View file

@ -113,6 +113,13 @@ uint8_t USB::SetAddress(uint8_t addr, uint8_t ep, EpInfo **ppep, uint16_t &nak_l
uint8_t mode = regRd(rMODE);
//Serial.print("\r\nMode: ");
//Serial.println( mode, HEX);
//Serial.print("\r\nLS: ");
//Serial.println(p->lowspeed, HEX);
// Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise
regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED));
@ -445,9 +452,9 @@ void USB::Task(void) //USB state machine
lowspeed = false;
break;
case LSHOST:
if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
// if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
lowspeed = true;
}
// }
case FSHOST: //attached
if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
delay = millis() + USB_SETTLE_DELAY;
@ -505,6 +512,10 @@ void USB::Task(void) //USB state machine
if (delay < millis()) usb_task_state = USB_STATE_CONFIGURING;
break;
case USB_STATE_CONFIGURING:
//Serial.print("\r\nConf.LS: ");
//Serial.println(lowspeed, HEX);
rcode = Configuring(0, 0, lowspeed);
if (rcode) {