Fixed TeensyHID bootloader so that it works with the official TeensyLoader GUI applic...
authorDean Camera <dean@fourwalledcubicle.com>
Thu, 6 May 2010 02:06:12 +0000 (02:06 +0000)
committerDean Camera <dean@fourwalledcubicle.com>
Thu, 6 May 2010 02:06:12 +0000 (02:06 +0000)
Bootloaders/TeensyHID/Descriptors.c
Bootloaders/TeensyHID/Descriptors.h
Bootloaders/TeensyHID/TeensyHID.c
Bootloaders/TeensyHID/TeensyHID.txt
Bootloaders/TeensyHID/makefile

index 9cd987c..d421d90 100644 (file)
  */\r
 USB_Descriptor_HIDReport_Datatype_t HIDReport[] =\r
 {\r
-       0x06, 0x9c, 0xff,     /* Usage Page (Vendor Defined)                     */\r
-       0x09, 0x1B,           /* Usage (Vendor Defined)                          */\r
-       0xa1, 0x01,           /* Collection (Vendor Defined)                     */\r
-       0x0a, 0x19, 0x00,     /*   Usage (Vendor Defined)                        */\r
-       0x75, 0x08,           /*   Report Size (8)                               */\r
-       0x95, 0x82,           /*   Report Count (130)                            */\r
-       0x15, 0x00,           /*   Logical Minimum (0)                           */\r
-       0x25, 0xff,           /*   Logical Maximum (255)                         */\r
-       0x91, 0x02,           /*   Output (Data, Variable, Absolute)             */\r
-       0xc0                  /* End Collection                                  */\r
+       0x06, 0x9c, 0xff,        /* Usage Page (Vendor Defined)                     */\r
+       0x09, TEENSY_USAGEPAGE,  /* Usage (Vendor Defined)                          */\r
+       0xa1, 0x01,              /* Collection (Vendor Defined)                     */\r
+       0x0a, 0x19, 0x00,        /*   Usage (Vendor Defined)                        */\r
+       0x75, 0x08,              /*   Report Size (8)                               */\r
+#if (SPM_PAGESIZE == 128)    /*   Report Count (SPM_PAGESIZE + 2)               */\r
+       0x95, (SPM_PAGESIZE + 2)\r
+#else\r
+       0x96, ((SPM_PAGESIZE + 2) & 0xFF), ((SPM_PAGESIZE + 2) >> 8),\r
+#endif\r
+       0x15, 0x00,              /*   Logical Minimum (0)                           */\r
+       0x25, 0xff,              /*   Logical Maximum (255)                         */\r
+       0x91, 0x02,              /*   Output (Data, Variable, Absolute)             */\r
+       0xc0                     /* End Collection                                  */\r
 };\r
 \r
 /** Device descriptor structure. This descriptor, located in FLASH memory, describes the overall\r
index 0ea7f39..37a2b64 100644 (file)
                \r
                /** Descriptor header type value, to indicate a HID class HID report descriptor. */\r
                #define DTYPE_Report              0x22\r
+               \r
+               /** Vendor usage page for the Teensy 1.0 board */\r
+               #define TEENSY_USAGEPAGE_10       0x19\r
+\r
+               /** Vendor usage page for the Teensy++ 1.0 board */\r
+               #define TEENSY_USAGEPAGE_10PP     0x1A\r
+\r
+               /** Vendor usage page for the Teensy 2.0 board */\r
+               #define TEENSY_USAGEPAGE_20       0x1B\r
+               \r
+               /** Vendor usage page for the Teensy++ 1.0 board */\r
+               #define TEENSY_USAGEPAGE_20PP     0x1C\r
+               \r
+               #if defined(USB_SERIES_2_AVR)\r
+                       #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_10\r
+               #elif defined(USB_SERIES_4_AVR)\r
+                       #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_20\r
+                       #define TEENSY_USAGE          TEENSY_USAGE_20\r
+               #elif defined(USB_SERIES_6_AVR)\r
+                       #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_10PP\r
+               #elif defined(USB_SERIES_7_AVR)\r
+                       #define TEENSY_USAGEPAGE      TEENSY_USAGEPAGE_20PP\r
+               #endif\r
 \r
        /* Function Prototypes: */\r
                uint16_t CALLBACK_USB_GetDescriptor(const uint16_t wValue, const uint8_t wIndex, void** const DescriptorAddress)\r
index 5431a57..4e287bc 100644 (file)
@@ -120,7 +120,7 @@ void EVENT_USB_Device_UnhandledControlRequest(void)
                                boot_spm_busy_wait();\r
                                \r
                                /* Write each of the FLASH page's bytes in sequence */\r
-                               for (uint8_t PageByte = 0; PageByte < SPM_PAGESIZE; PageByte += 2)\r
+                               for (uint16_t PageByte = 0; PageByte < SPM_PAGESIZE; PageByte += 2)\r
                                {\r
                                        /* Check if endpoint is empty - if so clear it and wait until ready for next packet */\r
                                        if (!(Endpoint_BytesInEndpoint()))\r
index 52b6327..9dac8f5 100644 (file)
@@ -11,7 +11,9 @@
  *  The following list indicates what microcontrollers are compatible with this demo.\r
  *\r
  *  - AT90USB162 (Teensy 1.0)\r
+ *  - AT90USB646 (Teensy++ 1.0)\r
  *  - ATMEGA32U4 (Teensy 2.0)\r
+ *  - AT90USB1287 (Teensy++ 2.0)\r
  *\r
  *  \section SSec_Info USB Information:\r
  *\r
index 404b55f..0d12374 100644 (file)
@@ -48,7 +48,7 @@
 \r
 \r
 # MCU name\r
-MCU = atmega32u4\r
+MCU = at90usb1287\r
 \r
 \r
 # Target board (see library "Board Types" documentation, NONE for projects not requiring\r
@@ -86,7 +86,7 @@ F_CLOCK = $(F_CPU)
 \r
 \r
 # Starting byte address of the bootloader\r
-BOOT_START = 0x7000\r
+BOOT_START = 0x1e000\r
 \r
 \r
 # Output format. (can be srec, ihex, binary)\r