Fixed TeensyHID bootloader so that it works with the official TeensyLoader GUI application with all supported AVR models.

This commit is contained in:
Dean Camera 2010-05-06 02:06:12 +00:00
parent fc31973daf
commit 298592383a
5 changed files with 42 additions and 13 deletions

View File

@ -46,11 +46,15 @@
USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
{
0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
0x09, 0x1B, /* Usage (Vendor Defined) */
0x09, TEENSY_USAGEPAGE, /* Usage (Vendor Defined) */
0xa1, 0x01, /* Collection (Vendor Defined) */
0x0a, 0x19, 0x00, /* Usage (Vendor Defined) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x82, /* Report Count (130) */
#if (SPM_PAGESIZE == 128) /* Report Count (SPM_PAGESIZE + 2) */
0x95, (SPM_PAGESIZE + 2)
#else
0x96, ((SPM_PAGESIZE + 2) & 0xFF), ((SPM_PAGESIZE + 2) >> 8),
#endif
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0xff, /* Logical Maximum (255) */
0x91, 0x02, /* Output (Data, Variable, Absolute) */

View File

@ -84,6 +84,29 @@
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
#define DTYPE_Report 0x22
/** Vendor usage page for the Teensy 1.0 board */
#define TEENSY_USAGEPAGE_10 0x19
/** Vendor usage page for the Teensy++ 1.0 board */
#define TEENSY_USAGEPAGE_10PP 0x1A
/** Vendor usage page for the Teensy 2.0 board */
#define TEENSY_USAGEPAGE_20 0x1B
/** Vendor usage page for the Teensy++ 1.0 board */
#define TEENSY_USAGEPAGE_20PP 0x1C
#if defined(USB_SERIES_2_AVR)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10
#elif defined(USB_SERIES_4_AVR)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20
#define TEENSY_USAGE TEENSY_USAGE_20
#elif defined(USB_SERIES_6_AVR)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_10PP
#elif defined(USB_SERIES_7_AVR)
#define TEENSY_USAGEPAGE TEENSY_USAGEPAGE_20PP
#endif
/* Function Prototypes: */
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);

View File

@ -120,7 +120,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
boot_spm_busy_wait();
/* Write each of the FLASH page's bytes in sequence */
for (uint8_t PageByte = 0; PageByte < SPM_PAGESIZE; PageByte += 2)
for (uint16_t PageByte = 0; PageByte < SPM_PAGESIZE; PageByte += 2)
{
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */
if (!(Endpoint_BytesInEndpoint()))

View File

@ -11,7 +11,9 @@
* The following list indicates what microcontrollers are compatible with this demo.
*
* - AT90USB162 (Teensy 1.0)
* - AT90USB646 (Teensy++ 1.0)
* - ATMEGA32U4 (Teensy 2.0)
* - AT90USB1287 (Teensy++ 2.0)
*
* \section SSec_Info USB Information:
*

View File

@ -48,7 +48,7 @@
# MCU name
MCU = atmega32u4
MCU = at90usb1287
# Target board (see library "Board Types" documentation, NONE for projects not requiring
@ -86,7 +86,7 @@ F_CLOCK = $(F_CPU)
# Starting byte address of the bootloader
BOOT_START = 0x7000
BOOT_START = 0x1e000
# Output format. (can be srec, ihex, binary)