mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
fixed directly connected low-speed device func.
This commit is contained in:
parent
a8bc10f7f5
commit
1c5db85af6
1 changed files with 14 additions and 3 deletions
15
Usb.cpp
15
Usb.cpp
|
@ -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);
|
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
|
// Set bmLOWSPEED and bmHUBPRE in case of low-speed device, reset them otherwise
|
||||||
regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED));
|
regWr(rMODE, (p->lowspeed) ? mode | bmLOWSPEED | bmHubPre : mode & ~(bmHUBPRE | bmLOWSPEED));
|
||||||
|
|
||||||
|
@ -445,9 +452,9 @@ void USB::Task(void) //USB state machine
|
||||||
lowspeed = false;
|
lowspeed = false;
|
||||||
break;
|
break;
|
||||||
case LSHOST:
|
case LSHOST:
|
||||||
if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
|
// if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
|
||||||
lowspeed = true;
|
lowspeed = true;
|
||||||
}
|
// }
|
||||||
case FSHOST: //attached
|
case FSHOST: //attached
|
||||||
if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
|
if ((usb_task_state & USB_STATE_MASK) == USB_STATE_DETACHED) {
|
||||||
delay = millis() + USB_SETTLE_DELAY;
|
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;
|
if (delay < millis()) usb_task_state = USB_STATE_CONFIGURING;
|
||||||
break;
|
break;
|
||||||
case USB_STATE_CONFIGURING:
|
case USB_STATE_CONFIGURING:
|
||||||
|
|
||||||
|
//Serial.print("\r\nConf.LS: ");
|
||||||
|
//Serial.println(lowspeed, HEX);
|
||||||
|
|
||||||
rcode = Configuring(0, 0, lowspeed);
|
rcode = Configuring(0, 0, lowspeed);
|
||||||
|
|
||||||
if (rcode) {
|
if (rcode) {
|
||||||
|
|
Loading…
Reference in a new issue