Fix TeensyHID bootloader for the largest AVRs - only the ATMEGA128x needs the alternative addressing scheme.

pull/1469/head
Dean Camera 15 years ago
parent 27eb17cb93
commit 2a2de8fea9

@ -96,15 +96,16 @@
/** Vendor usage page for the Teensy++ 2.0 board */ /** Vendor usage page for the Teensy++ 2.0 board */
#define TEENSY_USAGEPAGE_20PP 0x1C #define TEENSY_USAGEPAGE_20PP 0x1C
#if defined(USB_SERIES_2_AVR) #if (defined(__AVR_AT90USB162__) || defined(__AVR_ATmega16U2__))
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10 #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10
#elif defined(USB_SERIES_4_AVR) #elif defined(__AVR_ATmega32U4__)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20 #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20
#define TEENSY_USAGE TEENSY_USAGE_20 #elif (defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB647__))
#elif defined(USB_SERIES_6_AVR)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10PP #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10PP
#elif defined(USB_SERIES_7_AVR) #elif (defined(__AVR_AT90USB1286__) || defined(__AVR_AT90USB1287__))
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20PP #define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20PP
#else
#error The selected AVR model is not currently supported by the TeensyHID bootloader.
#endif #endif
/* Function Prototypes: */ /* Function Prototypes: */

@ -115,10 +115,10 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
} }
else else
{ {
#if (SPM_PAGESIZE == 128) #if (FLASHEND > 0xFFFF)
uint16_t PageByteAddress = PageIndex;
#else
uint32_t PageByteAddress = ((uint32_t)PageIndex << 8); uint32_t PageByteAddress = ((uint32_t)PageIndex << 8);
#else
uint16_t PageByteAddress = PageIndex;
#endif #endif
/* Erase the given FLASH page, ready to be programmed */ /* Erase the given FLASH page, ready to be programmed */

@ -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 * via a bit-banged (emulated) version of the USB protocol. They are limited in their capabilities due to the cycles required
* to be dedicated to managing the USB bus, but offer a cheap way to implement USB functionality into a design. * to be dedicated to managing the USB bus, but offer a cheap way to implement USB functionality into a design.
* *
* - <b>Name:</b> AVR309: Software USB (<i>Objective Development</i>) \n * - <b>Name:</b> AVR309: Software USB (<i>Atmel</i>) \n
* <b>Cost:</b> Free for some uses, see website for licensing \n * <b>Cost:</b> Free \n
* <b>License:</b> None Stated \n * <b>License:</b> None Stated \n
* <b>Website:</b> http://www.atmel.com/dyn/Products/app_notes.asp?family_id=607 \n * <b>Website:</b> http://www.atmel.com/dyn/Products/app_notes.asp?family_id=607 \n
* <b>Description:</b> Atmel's official software USB implementation, an Application Note containing work by Igor Cesko. This * <b>Description:</b> Atmel's official software USB implementation, an Application Note containing work by Igor Cesko. This

Loading…
Cancel
Save