started working on implementing receiving HID output reports from PC for commands
This commit is contained in:
BIN
bia_microddr_hid_rpt_desc.hid
Normal file
BIN
bia_microddr_hid_rpt_desc.hid
Normal file
Binary file not shown.
@@ -78,6 +78,7 @@
|
||||
<archiverTool>
|
||||
</archiverTool>
|
||||
<loading>
|
||||
<loadableFile>../../bootloader/bia_microddr_bootloader.X/dist/default/production/bia_microddr_bootloader.X.production.hex</loadableFile>
|
||||
<useAlternateLoadableFile>false</useAlternateLoadableFile>
|
||||
<parseOnProdLoad>false</parseOnProdLoad>
|
||||
<alternateLoadableFile></alternateLoadableFile>
|
||||
@@ -224,6 +225,7 @@
|
||||
value="Press to browse for a specific firmware version"/>
|
||||
<property key="ToolFirmwareOption.UseLatestFirmware" value="true"/>
|
||||
<property key="debugoptions.useswbreakpoints" value="false"/>
|
||||
<property key="firmware.download.all" value="false"/>
|
||||
<property key="hwtoolclock.frcindebug" value="false"/>
|
||||
<property key="memories.aux" value="false"/>
|
||||
<property key="memories.bootflash" value="true"/>
|
||||
|
||||
@@ -65,20 +65,29 @@ typedef union _INTPUT_CONTROLS_TYPEDEF
|
||||
} INPUT_CONTROLS;
|
||||
|
||||
// USB data must exist within the USB RAM memory space
|
||||
uint8_t joystick_output[64] __at(0x500);
|
||||
INPUT_CONTROLS joystick_input __at(0x600);
|
||||
|
||||
// handle to the last data transmission - allows us to check if it completed
|
||||
USB_VOLATILE USB_HANDLE lastTransmission = 0;
|
||||
USB_VOLATILE USB_HANDLE lastReceived = 0;
|
||||
|
||||
void DANCEPAD_Initialize()
|
||||
{
|
||||
lastTransmission = 0;
|
||||
|
||||
//enable the HID endpoint
|
||||
USBEnableEndpoint(JOYSTICK_EP, USB_IN_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP);
|
||||
USBEnableEndpoint(JOYSTICK_EP, USB_IN_ENABLED | USB_OUT_ENABLED | USB_HANDSHAKE_ENABLED | USB_DISALLOW_SETUP);
|
||||
|
||||
lastReceived = HIDRxPacket(JOYSTICK_EP,&(joystick_output[0]),64);
|
||||
}
|
||||
void DANCEPAD_Tasks()
|
||||
{
|
||||
if (!HIDRxHandleBusy(lastReceived))
|
||||
{
|
||||
lastReceived = HIDRxPacket(JOYSTICK_EP,&(joystick_output[0]),64);
|
||||
}
|
||||
|
||||
// do not start another transmission if the previous one isn't completed
|
||||
if(HIDTxHandleBusy(lastTransmission))
|
||||
return;
|
||||
|
||||
@@ -170,7 +170,8 @@
|
||||
#define HID_INT_OUT_EP_SIZE 64
|
||||
#define HID_INT_IN_EP_SIZE 64
|
||||
#define HID_NUM_OF_DSC 1
|
||||
#define HID_RPT01_SIZE 74
|
||||
//#define HID_RPT01_SIZE 74
|
||||
#define HID_RPT01_SIZE 54
|
||||
|
||||
/** DEFINITIONS ****************************************************/
|
||||
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
|
||||
@@ -239,6 +247,33 @@ const uint8_t *const USB_SD_Ptr[]=
|
||||
|
||||
const struct{uint8_t report[HID_RPT01_SIZE];}hid_rpt01={{
|
||||
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 ***************************************************/
|
||||
|
||||
Reference in New Issue
Block a user