Fix HID class bootloader not working on the larger USB AVRs due to the altered page...
authorDean Camera <dean@fourwalledcubicle.com>
Sat, 23 Apr 2011 04:39:21 +0000 (04:39 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Sat, 23 Apr 2011 04:39:21 +0000 (04:39 +0000)
Bootloaders/HID/BootloaderHID.c

index f048043..484942f 100644 (file)
@@ -113,10 +113,18 @@ void EVENT_USB_Device_ControlRequest(void)
                        while (!(Endpoint_IsOUTReceived()));\r
                \r
                        /* Read in the write destination address */\r
+                       #if (FLASHEND > 0xFFFF)\r
+                       uint32_t PageAddress = ((uint32_t)Endpoint_Read_16_LE() << 8);\r
+                       #else\r
                        uint16_t PageAddress = Endpoint_Read_16_LE();\r
+                       #endif\r
                        \r
                        /* Check if the command is a program page command, or a start application command */\r
-                       if (PageAddress == COMMAND_STARTAPPLICATION)\r
+                       #if (FLASHEND > 0xFFFF)\r
+                       if ((uint16_t)(PageAddress >> 8) == COMMAND_STARTAPPLICATION)\r
+                       #else\r
+                       if (PageAddress == COMMAND_STARTAPPLICATION)                    \r
+                       #endif\r
                        {\r
                                RunBootloader = false;\r
                        }\r