finished adding ability for host to put device into bootloader mode by sending a 1-byte command in a HID output report

This commit is contained in:
2019-08-23 00:44:06 -04:00
parent ecb1c559f3
commit e55bbc58f3
4 changed files with 69 additions and 113 deletions

View File

@@ -182,7 +182,7 @@ const uint8_t configDescriptor1[]={
USB_DESCRIPTOR_INTERFACE, // INTERFACE descriptor type
0, // Interface Number
0, // Alternate Setting Number
1, // Number of endpoints in this intf
2, // Number of endpoints in this intf
HID_INTF, // Class code
0, // Subclass code
0, // Protocol code
@@ -246,69 +246,32 @@ const uint8_t *const USB_SD_Ptr[]=
};
const struct{uint8_t report[HID_RPT01_SIZE];}hid_rpt01={{
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x05, // USAGE (Game Pad)
0xa1, 0x01, // COLLECTION (Application)
/* Input: 6 Buttons, 1 bit per button */
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x06, // USAGE_MAXIMUM (Button 6)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x25, 0x01, // LOGICAL_MAXIMUM (1)
0x35, 0x00, // PHYSICAL_MINIMUM (0)
0x45, 0x01, // PHYSICAL_MAXIMUM (1)
0x75, 0x01, // REPORT_SIZE (1)
0x95, 0x06, // REPORT_COUNT (6)
0x05, 0x09, // USAGE_PAGE (Button)
0x19, 0x01, // USAGE_MINIMUM (Button 1)
0x29, 0x06, // USAGE_MAXIMUM (Button 6)
0x81, 0x02, // INPUT (Data,Var,Abs)
/* Input: 2 bit pad to align data to byte boundary */
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
/* Output: Single 8-bit byte for control commands from PC */
0x06, 0x00, 0xff, // USAGE_PAGE (Generic Desktop)
0x09, 0x01, // USAGE (Vendor Usage 1)
0xa1, 0x01, // COLLECTION (Application)
0x19, 0x01, // USAGE_MINIMUM (Vendor Usage 1)
0x29, 0x40, // USAGE_MAXIMUM (Vendor Usage 2)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x40, // REPORT_COUNT (1)
0x91, 0x00, // OUTPUT (Data,Ary,Abs)
0xc0, // END_COLLECTION
0xc0 //
/*0x05,0x01, //USAGE_PAGE (Generic Desktop)
0x09,0x05, //USAGE (Game Pad)
0xA1,0x01, //COLLECTION (Application)
0x15,0x00, // LOGICAL_MINIMUM(0)
0x25,0x01, // LOGICAL_MAXIMUM(1)
0x35,0x00, // PHYSICAL_MINIMUM(0)
0x45,0x01, // PHYSICAL_MAXIMUM(1)
0x75,0x01, // REPORT_SIZE(1)
0x95,0x0D, // REPORT_COUNT(13)
0x05,0x09, // USAGE_PAGE(Button)
0x19,0x01, // USAGE_MINIMUM(Button 1)
0x29,0x0D, // USAGE_MAXIMUM(Button 13)
0x81,0x02, // INPUT(Data,Var,Abs)
0x95,0x03, // REPORT_COUNT(3)
0x81,0x01, // INPUT(Cnst,Ary,Abs)
0x05,0x01, // USAGE_PAGE(Generic Desktop)
0x25,0x07, // LOGICAL_MAXIMUM(7)
0x46,0x3B,0x01, // PHYSICAL_MAXIMUM(315)
0x75,0x04, // REPORT_SIZE(4)
0x95,0x01, // REPORT_COUNT(1)
0x65,0x14, // UNIT(Eng Rot:Angular Pos)
0x09,0x39, // USAGE(Hat Switch)
0x81,0x42, // INPUT(Data,Var,Abs,Null)
0x65,0x00, // UNIT(None)
0x95,0x01, // REPORT_COUNT(1)
0x81,0x01, // INPUT(Cnst,Ary,Abs)
0x26,0xFF,0x00, // LOGICAL_MAXIMUM(255)
0x46,0xFF,0x00, // PHYSICAL_MAXIMUM(255)
0x09,0x30, // USAGE(X)
0x09,0x31, // USAGE(Y)
0x09,0x32, // USAGE(Z)
0x09,0x35, // USAGE(Rz)
0x75,0x08, // REPORT_SIZE(8)
0x95,0x04, // REPORT_COUNT(4)
0x81,0x02, // INPUT(Data,Var,Abs)
0xC0*/ //END_COLLECTION
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x91, 0x00, // OUTPUT (Data,Ary,Abs)
0xc0 // END_COLLECTION
}
};
/** EOF usb_descriptors.c ***************************************************/