/** Event handler for the USB_Disconnect event. This indicates that the bootloader should exit and the user\r
* application started.\r
*/\r
-EVENT_HANDLER(USB_Disconnect)\r
+void EVENT_USB_Disconnect(void)\r
{\r
/* Upon disconnection, run user application */\r
RunBootloader = false;\r
* control requests that are not handled internally by the USB library (including the DFU commands, which are\r
* all issued via the control endpoint), so that they can be handled appropriately for the application.\r
*/\r
-EVENT_HANDLER(USB_UnhandledControlPacket)\r
+void EVENT_USB_UnhandledControlPacket(void)\r
{\r
/* Get the size of the command and data from the wLength value */\r
SentCommand.DataSize = USB_ControlRequest.wLength;\r
}\r
\r
/* Read the flash word and send it via USB to the host */\r
- #if defined(RAMPZ)\r
+ #if (FLASHEND > 0xFFFF)\r
Endpoint_Write_Word_LE(pgm_read_word_far(CurrFlashAddress.Long));\r
#else\r
Endpoint_Write_Word_LE(pgm_read_word(CurrFlashAddress.Long)); \r
/* Wait until next data packet received */\r
while (!(Endpoint_IsOUTReceived()));\r
}\r
-\r
- Endpoint_Discard_Byte(); \r
+ else\r
+ {\r
+ Endpoint_Discard_Byte();\r
+ }\r
}\r
}\r
\r
while (CurrFlashAddress < BOOT_START_ADDR)\r
{\r
/* Check if the current byte is not blank */\r
- #if defined(RAMPZ)\r
+ #if (FLASHEND > 0xFFFF)\r
if (pgm_read_byte_far(CurrFlashAddress) != 0xFF)\r
#else\r
if (pgm_read_byte(CurrFlashAddress) != 0xFF)\r