Fix TeensyHID bootloader for the largest AVRs - only the ATMEGA128x needs the alterna...
authorDean Camera <dean@fourwalledcubicle.com>
Fri, 7 May 2010 06:48:27 +0000 (06:48 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Fri, 7 May 2010 06:48:27 +0000 (06:48 +0000)
Bootloaders/TeensyHID/Descriptors.h
Bootloaders/TeensyHID/TeensyHID.c
LUFA/ManPages/AlternativeStacks.txt

index f72dec2..8ef964d 100644 (file)
                /** Vendor usage page for the Teensy++ 2.0 board */\r
                #define TEENSY_USAGEPAGE_20PP     0x1C\r
                \r
-               #if defined(USB_SERIES_2_AVR)\r
+               #if (defined(__AVR_AT90USB162__) || defined(__AVR_ATmega16U2__))\r
                        #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_10\r
-               #elif defined(USB_SERIES_4_AVR)\r
+               #elif defined(__AVR_ATmega32U4__)\r
                        #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_20\r
-                       #define TEENSY_USAGE          TEENSY_USAGE_20\r
-               #elif defined(USB_SERIES_6_AVR)\r
+               #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__))\r
                        #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_10PP\r
-               #elif defined(USB_SERIES_7_AVR)\r
+               #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))\r
                        #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_20PP\r
+               #else\r
+                       #error The selected AVR model is not currently supported by the TeensyHID bootloader.\r
                #endif\r
 \r
        /* Function Prototypes: */\r
index ff28927..ffbaca8 100644 (file)
@@ -115,10 +115,10 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                        }\r
                        else\r
                        {\r
-                               #if (SPM_PAGESIZE == 128)\r
-                               uint16_t PageByteAddress = PageIndex;\r
-                               #else\r
+                               #if (FLASHEND > 0xFFFF)\r
                                uint32_t PageByteAddress = ((uint32_t)PageIndex << 8);\r
+                               #else\r
+                               uint16_t PageByteAddress = PageIndex;\r
                                #endif\r
                        \r
                                /* Erase the given FLASH page, ready to be programmed */\r
index 28176ce..0ce9150 100644 (file)
@@ -43,8 +43,8 @@
  *  via a bit-banged (emulated) version of the USB protocol. They are limited in their capabilities due to the cycles required\r
  *  to be dedicated to managing the USB bus, but offer a cheap way to implement USB functionality into a design.\r
  *\r
- *  - <b>Name:</b> AVR309: Software USB (<i>Objective Development</i>) \n\r
- *    <b>Cost:</b> Free for some uses, see website for licensing \n\r
+ *  - <b>Name:</b> AVR309: Software USB (<i>Atmel</i>) \n\r
+ *    <b>Cost:</b> Free \n\r
  *    <b>License:</b> None Stated \n\r
  *    <b>Website:</b> http://www.atmel.com/dyn/Products/app_notes.asp?family_id=607 \n\r
  *    <b>Description:</b> Atmel's official software USB implementation, an Application Note containing work by Igor Cesko. This\r