const USB_Descriptor_HIDReport_Datatype_t PROGMEM JoystickReport[] =
{
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x04, // USAGE (Joystick)
0xa1, 0x01, // COLLECTION (Application)
0x85, 0x01, // REPORT_ID (1)
0x05, 0x02, // USAGE_PAGE (Simulation Controls)
0x09, 0xbb, // USAGE (Throttle)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x01, // REPORT_COUNT (1)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x05, 0x01, // USAGE_PAGE (Generic Desktop)
0x09, 0x30, // USAGE (X)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x31, // USAGE (Y)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x09, 0x32, // USAGE (Z)
0x81, 0x02, // INPUT (Data,Var,Abs)
0x06, 0x00, 0xFF, // Vendor Defined Page 1
0x09, 0x02, // Vendor Usage 2
0x85, 0x01, // REPORT_ID (1)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x07, // REPORT_COUNT (7)
0xb1, 0x02, // FEATURE (Data,Var,Abs)
0x09, 0x02, // Vendor Usage 2
0x85, 0x02, // REPORT_ID (2)
0x15, 0x00, // LOGICAL_MINIMUM (0)
0x26, 0xff, 0x00, // LOGICAL_MAXIMUM (255)
0x75, 0x08, // REPORT_SIZE (8)
0x95, 0x40, // REPORT_COUNT (64)
0x91, 0x02, // OUTPUT (Data,Var,Abs)
0xc0, // END_COLLECTION
};
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo,
uint8_t* const ReportID,
const uint8_t ReportType,
void* ReportData,
uint16_t* const ReportSize)
{
switch (ReportType)
{
case HID_REPORT_ITEM_Feature:
if (*ReportID == 1)
{
HID_JoyEventReport2_t* EventReport = (HID_JoyEventReport2_t*)ReportData;
EventReport->EventCount = 0;
EventReport->Event1Id = 255;
EventReport->Event1Data = 0;
EventReport->Event2Id = 255;
EventReport->Event2Data = 0;
EventReport->Event3Id = 255;
EventReport->Event3Data = 0;
*ReportSize = sizeof(HID_JoyEventReport2_t); //
}
break;
}
return false;
}
typedef struct
{
uint8_t EventCount;
uint8_t Event1Id;
uint8_t Event1Data;
uint8_t Event2Id;
uint8_t Event2Data;
uint8_t Event3Id;
uint8_t Event3Data;
} HID_JoyEventReport2_t;
static uint8_t PrevJoystickHIDReportBuffer[sizeof(USB_JoystickReport_Data_t)];