X-Git-Url: http://git.linex4red.de/pub/USBasp.git/blobdiff_plain/c1a1b6eeecb375259968ef6d989833312047f2d8..5712b8dff669dc1947cd7d6f34f13eb9fe6a8d0a:/Bootloaders/TeensyHID/TeensyHID.c diff --git a/Bootloaders/TeensyHID/TeensyHID.c b/Bootloaders/TeensyHID/TeensyHID.c index 4f09ac50b..f82e28e72 100644 --- a/Bootloaders/TeensyHID/TeensyHID.c +++ b/Bootloaders/TeensyHID/TeensyHID.c @@ -53,8 +53,8 @@ int main(void) MCUSR &= ~(1 << WDRF); wdt_disable(); - /* Disable Clock Division */ - SetSystemClockPrescaler(0); + /* Disable clock division */ + clock_prescale_set(clock_div_1); /* Relocate the interrupt vector table to the bootloader section */ MCUCR = (1 << IVCE); @@ -101,10 +101,10 @@ EVENT_HANDLER(USB_UnhandledControlPacket) case REQ_SetReport: if (bmRequestType == (REQDIR_HOSTTODEVICE | REQTYPE_CLASS | REQREC_INTERFACE)) { - Endpoint_ClearSetupReceived(); + Endpoint_ClearControlSETUP(); /* Wait until the command (report) has been sent by the host */ - while (!(Endpoint_IsSetupOUTReceived())); + while (!(Endpoint_IsOUTReceived())); /* Read in the write destination address */ uint16_t PageAddress = Endpoint_Read_Word_LE(); @@ -126,8 +126,8 @@ EVENT_HANDLER(USB_UnhandledControlPacket) /* Check if endpoint is empty - if so clear it and wait until ready for next packet */ if (!(Endpoint_BytesInEndpoint())) { - Endpoint_ClearSetupOUT(); - while (!(Endpoint_IsSetupOUTReceived())); + Endpoint_ClearControlOUT(); + while (!(Endpoint_IsOUTReceived())); } /* Write the next data word to the FLASH page */ @@ -142,13 +142,11 @@ EVENT_HANDLER(USB_UnhandledControlPacket) boot_rww_enable(); } - Endpoint_ClearSetupOUT(); + Endpoint_ClearControlOUT(); - /* Wait until the host is ready to receive the request confirmation */ - while (!(Endpoint_IsSetupINReady())); - - /* Handshake the request by sending an empty IN packet */ - Endpoint_ClearSetupIN(); + /* Acknowledge status stage */ + while (!(Endpoint_IsINReady())); + Endpoint_ClearControlIN(); } break;