Browse Source

Don't crash when USB_USBCMD_ATDTW isn't working

teensy4-core
PaulStoffregen 4 years ago
parent
commit
b141c8b562
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      teensy4/usb.c

+ 2
- 2
teensy4/usb.c View File

if (USB1_ENDPTPRIME & epmask) goto end; if (USB1_ENDPTPRIME & epmask) goto end;
//digitalWriteFast(2, HIGH); //digitalWriteFast(2, HIGH);
//ret |= 0x01; //ret |= 0x01;
uint32_t status;
uint32_t status, cyccnt=ARM_DWT_CYCCNT;
do { do {
USB1_USBCMD |= USB_USBCMD_ATDTW; USB1_USBCMD |= USB_USBCMD_ATDTW;
status = USB1_ENDPTSTATUS; status = USB1_ENDPTSTATUS;
} while (!(USB1_USBCMD & USB_USBCMD_ATDTW));
} while (!(USB1_USBCMD & USB_USBCMD_ATDTW) && (ARM_DWT_CYCCNT - cyccnt < 2400));
//USB1_USBCMD &= ~USB_USBCMD_ATDTW; //USB1_USBCMD &= ~USB_USBCMD_ATDTW;
if (status & epmask) goto end; if (status & epmask) goto end;
//ret |= 0x02; //ret |= 0x02;

Loading…
Cancel
Save