forked from mfulz_github/qmk_firmware
Fixed TeensyHID bootloader so that it works with the official TeensyLoader GUI application with all supported AVR models.
This commit is contained in:
parent
fc31973daf
commit
298592383a
|
@ -45,16 +45,20 @@
|
||||||
*/
|
*/
|
||||||
USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
|
USB_Descriptor_HIDReport_Datatype_t HIDReport[] =
|
||||||
{
|
{
|
||||||
0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
|
0x06, 0x9c, 0xff, /* Usage Page (Vendor Defined) */
|
||||||
0x09, 0x1B, /* Usage (Vendor Defined) */
|
0x09, TEENSY_USAGEPAGE, /* Usage (Vendor Defined) */
|
||||||
0xa1, 0x01, /* Collection (Vendor Defined) */
|
0xa1, 0x01, /* Collection (Vendor Defined) */
|
||||||
0x0a, 0x19, 0x00, /* Usage (Vendor Defined) */
|
0x0a, 0x19, 0x00, /* Usage (Vendor Defined) */
|
||||||
0x75, 0x08, /* Report Size (8) */
|
0x75, 0x08, /* Report Size (8) */
|
||||||
0x95, 0x82, /* Report Count (130) */
|
#if (SPM_PAGESIZE == 128) /* Report Count (SPM_PAGESIZE + 2) */
|
||||||
0x15, 0x00, /* Logical Minimum (0) */
|
0x95, (SPM_PAGESIZE + 2)
|
||||||
0x25, 0xff, /* Logical Maximum (255) */
|
#else
|
||||||
0x91, 0x02, /* Output (Data, Variable, Absolute) */
|
0x96, ((SPM_PAGESIZE + 2) & 0xFF), ((SPM_PAGESIZE + 2) >> 8),
|
||||||
0xc0 /* End Collection */
|
#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
|
/** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall
|
||||||
|
|
|
@ -84,6 +84,29 @@
|
||||||
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
|
/** Descriptor header type value, to indicate a HID class HID report descriptor. */
|
||||||
#define DTYPE_Report 0x22
|
#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: */
|
/* Function Prototypes: */
|
||||||
uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)
|
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);
|
ATTR_WARN_UNUSED_RESULT ATTR_NON_NULL_PTR_ARG(3);
|
||||||
|
|
|
@ -120,7 +120,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
|
||||||
boot_spm_busy_wait();
|
boot_spm_busy_wait();
|
||||||
|
|
||||||
/* Write each of the FLASH page's bytes in sequence */
|
/* 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 */
|
/* Check if endpoint is empty - if so clear it and wait until ready for next packet */
|
||||||
if (!(Endpoint_BytesInEndpoint()))
|
if (!(Endpoint_BytesInEndpoint()))
|
||||||
|
|
|
@ -11,7 +11,9 @@
|
||||||
* The following list indicates what microcontrollers are compatible with this demo.
|
* The following list indicates what microcontrollers are compatible with this demo.
|
||||||
*
|
*
|
||||||
* - AT90USB162 (Teensy 1.0)
|
* - AT90USB162 (Teensy 1.0)
|
||||||
|
* - AT90USB646 (Teensy++ 1.0)
|
||||||
* - ATMEGA32U4 (Teensy 2.0)
|
* - ATMEGA32U4 (Teensy 2.0)
|
||||||
|
* - AT90USB1287 (Teensy++ 2.0)
|
||||||
*
|
*
|
||||||
* \section SSec_Info USB Information:
|
* \section SSec_Info USB Information:
|
||||||
*
|
*
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
|
|
||||||
|
|
||||||
# MCU name
|
# MCU name
|
||||||
MCU = atmega32u4
|
MCU = at90usb1287
|
||||||
|
|
||||||
|
|
||||||
# Target board (see library "Board Types" documentation, NONE for projects not requiring
|
# 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
|
# Starting byte address of the bootloader
|
||||||
BOOT_START = 0x7000
|
BOOT_START = 0x1e000
|
||||||
|
|
||||||
|
|
||||||
# Output format. (can be srec, ihex, binary)
|
# Output format. (can be srec, ihex, binary)
|
||||||
|
|
Loading…
Reference in New Issue