Commit 29859238 authored by Dean Camera's avatar Dean Camera
Browse files

Fixed TeensyHID bootloader so that it works with the official TeensyLoader GUI...

Fixed TeensyHID bootloader so that it works with the official TeensyLoader GUI application with all supported AVR models.
parent fc31973d
......@@ -45,16 +45,20 @@
*/
USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
{
0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
0x09, 0x1B, /* Usage (Vendor Defined) */
0xa1, 0x01, /* Collection (Vendor Defined) */
0x0a, 0x19, 0x00, /* Usage (Vendor Defined) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x82, /* Report Count (130) */
0x15, 0x00, /* Logical Minimum (0) */
0x25, 0xff, /* Logical Maximum (255) */
0x91, 0x02, /* Output (Data, Variable, Absolute) */
0xc0 /* End Collection */
0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
0x09, TEENSY_USAGEPAGE, /* Usage (Vendor Defined) */
0xa1, 0x01, /* Collection (Vendor Defined) */
0x0a, 0x19, 0x00, /* Usage (Vendor Defined) */
0x75, 0x08, /* Report Size (8) */
#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) */
0xc0 /* End Collection */
};
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
......
......@@ -83,6 +83,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)
......
......@@ -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()))
......
......@@ -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:
*
......
......@@ -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)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment