started working on implementing receiving HID output reports from PC for commands

This commit is contained in:
2019-08-22 20:24:44 -04:00
parent 0ad1f818c0
commit ecb1c559f3
5 changed files with 52 additions and 5 deletions

View File

@@ -170,7 +170,7 @@ const uint8_t configDescriptor1[]={
/* Configuration Descriptor */
0x09,//sizeof(USB_CFG_DSC), // Size of this descriptor in bytes
USB_DESCRIPTOR_CONFIGURATION, // CONFIGURATION descriptor type
DESC_CONFIG_WORD(0x0022), // Total length of data for this cfg
DESC_CONFIG_WORD(0x0029), // Total length of data for this cfg
1, // Number of interfaces in this cfg
1, // Index value of this configuration
0, // Configuration string index
@@ -204,6 +204,14 @@ const uint8_t configDescriptor1[]={
_INTERRUPT, //Attributes
DESC_CONFIG_WORD(64), //size
0x01, //Interval
/* Endpoint Descriptor */
0x07,/*sizeof(USB_EP_DSC)*/
USB_DESCRIPTOR_ENDPOINT, //Endpoint Descriptor
JOYSTICK_EP | _EP_OUT, //EndpointAddress
_INTERRUPT, //Attributes
DESC_CONFIG_WORD(64), //size
0x01, //Interval
};
@@ -238,7 +246,34 @@ 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)
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)
0x95, 0x02, // REPORT_COUNT (2)
0x81, 0x01, // INPUT (Cnst,Ary,Abs)
0x06, 0x00, 0xff, // USAGE_PAGE (Vendor Defined Page 1)
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)
@@ -273,7 +308,7 @@ const struct{uint8_t report[HID_RPT01_SIZE];}hid_rpt01={{
0x75,0x08, // REPORT_SIZE(8)
0x95,0x04, // REPORT_COUNT(4)
0x81,0x02, // INPUT(Data,Var,Abs)
0xC0 //END_COLLECTION
0xC0*/ //END_COLLECTION
}
};
/** EOF usb_descriptors.c ***************************************************/