forked from mfulz_github/qmk_firmware
Added new ReportType parameter to the HID Device Class driver CALLBACK_HID_Device_CreateHIDReport() callback to indicate the report type to generate.
This commit is contained in:
parent
c438d01f87
commit
8b009bc113
|
@ -198,7 +198,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
#endif
|
||||
|
|
|
@ -142,7 +142,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
if (HIDReportEcho.ReportID)
|
||||
*ReportID = HIDReportEcho.ReportID;
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_JoystickReport_Data_t* JoystickReport = (USB_JoystickReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
uint8_t JoyStatus_LCL = Joystick_GetStatus();
|
||||
uint8_t ButtonStatus_LCL = Buttons_GetStatus();
|
||||
|
|
|
@ -71,7 +71,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ ISR(TIMER0_COMPA_vect, ISR_BLOCK)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@
|
|||
bool CALLBACK_MS_Device_SCSICommandReceived(USB_ClassInfo_MS_Device_t* MSInterfaceInfo);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_MouseReport_Data_t* MouseReport = (USB_MouseReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -43,6 +43,11 @@
|
|||
extern USB_ClassInfo_HID_Device_t Mouse_HID_Device_Interface;
|
||||
|
||||
/* Function Prototypes: */
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
void EVENT_USB_Device_Connect(void);
|
||||
void EVENT_USB_Device_Disconnect(void);
|
||||
void EVENT_USB_Device_ConfigurationChanged(void);
|
||||
|
|
|
@ -50,7 +50,7 @@ USB_ClassInfo_HID_Host_t Mouse_HID_Host_Interface =
|
|||
.HIDInterfaceProtocol = HID_BOOT_MOUSE_PROTOCOL,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** Event handler for the USB_DeviceAttached event. This indicates that a device has been attached to the host, and
|
||||
* starts the library USB task to begin the enumeration and USB management process.
|
||||
|
|
|
@ -50,10 +50,11 @@ void HID_Device_ProcessControlRequest(USB_ClassInfo_HID_Device_t* const HIDInter
|
|||
|
||||
uint16_t ReportINSize = 0;
|
||||
uint8_t ReportID = (USB_ControlRequest.wValue & 0xFF);
|
||||
uint8_t ReportType = (USB_ControlRequest.wValue >> 8) - 1;
|
||||
|
||||
memset(HIDInterfaceInfo->Config.PrevReportINBuffer, 0, HIDInterfaceInfo->Config.PrevReportINBufferSize);
|
||||
|
||||
CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID,
|
||||
CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportType,
|
||||
HIDInterfaceInfo->Config.PrevReportINBuffer, &ReportINSize);
|
||||
|
||||
Endpoint_SelectEndpoint(ENDPOINT_CONTROLEP);
|
||||
|
@ -158,7 +159,8 @@ void HID_Device_USBTask(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo)
|
|||
|
||||
memset(ReportINData, 0, sizeof(ReportINData));
|
||||
|
||||
bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, ReportINData, &ReportINSize);
|
||||
bool ForceSend = CALLBACK_HID_Device_CreateHIDReport(HIDInterfaceInfo, &ReportID, REPORT_ITEM_TYPE_In,
|
||||
ReportINData, &ReportINSize);
|
||||
bool StatesChanged = false;
|
||||
bool IdlePeriodElapsed = (HIDInterfaceInfo->State.IdleCount && !(HIDInterfaceInfo->State.IdleMSRemaining));
|
||||
|
||||
|
|
|
@ -147,15 +147,16 @@
|
|||
* \param[in,out] ReportID If preset to a non-zero value, this is the report ID being requested by the host. If zero, this should
|
||||
* be set to the report ID of the generated HID input report (if any). If multiple reports are not sent via the
|
||||
* given HID interface, this parameter should be ignored.
|
||||
* \param[out] ReportData Pointer to a buffer where the generated HID report should be stored.
|
||||
* \param[in] ReportType Type of HID report to generate, either \ref REPORT_ITEM_TYPE_In or \ref REPORT_ITEM_TYPE_Feature
|
||||
* \param[out] ReportData Pointer to a buffer where the generated HID report should be stored
|
||||
* \param[out] ReportSize Number of bytes in the generated input report, or zero if no report is to be sent
|
||||
*
|
||||
* \return Boolean true to force the sending of the report even if it is identical to the previous report and still within
|
||||
* the idle period (useful for devices which report relative movement), false otherwise
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1) ATTR_NON_NULL_PTR_ARG(2)
|
||||
ATTR_NON_NULL_PTR_ARG(3) ATTR_NON_NULL_PTR_ARG(4);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize) ATTR_NON_NULL_PTR_ARG(1)
|
||||
ATTR_NON_NULL_PTR_ARG(2) ATTR_NON_NULL_PTR_ARG(4) ATTR_NON_NULL_PTR_ARG(5);
|
||||
|
||||
/** HID class driver callback for the user processing of a received HID OUT report. This callback may fire in response to
|
||||
* either HID class control requests from the host, or by the normal HID endpoint polling procedure. Inside this callback
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
* - The SCSI_Request_Sense_Response_t and SCSI_Inquiry_Response_t type defines are now part of the Mass Storage Class
|
||||
* driver common defines, rather than being defined in the Host mode Class driver section only
|
||||
* - The USB_MODE_HOST token is now defined even when host mode is not available
|
||||
* - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to
|
||||
* indicate the report type to generate
|
||||
*
|
||||
* <b>Fixed:</b>
|
||||
* - Added missing CDC_Host_CreateBlockingStream() function code to the CDC Host Class driver
|
||||
|
|
|
@ -12,7 +12,9 @@
|
|||
*
|
||||
* \section Sec_MigrationXXXXXX Migrating from 091122 to XXXXXX
|
||||
*
|
||||
* <b>There is no migration information for this version.</b>
|
||||
* <b>Device Mode</b>
|
||||
* - The CALLBACK_HID_Device_CreateHIDReport() HID Device Class driver callback now has a new ReportType parameter to
|
||||
* indicate the report type to generate. Existing applications may simply add and ignore this additional parameter.
|
||||
*
|
||||
* \section Sec_Migration091122 Migrating from 090924 to 091122
|
||||
*
|
||||
|
|
|
@ -169,7 +169,7 @@ void EVENT_USB_Device_StartOfFrame(void)
|
|||
* \return Boolean true to force the sending of the report, false to let the library determine if it needs to be sent
|
||||
*/
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize)
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize)
|
||||
{
|
||||
USB_KeyboardReport_Data_t* KeyboardReport = (USB_KeyboardReport_Data_t*)ReportData;
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
void EVENT_USB_Device_StartOfFrame(void);
|
||||
|
||||
bool CALLBACK_HID_Device_CreateHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, uint8_t* const ReportID,
|
||||
void* ReportData, uint16_t* ReportSize);
|
||||
const uint8_t ReportType, void* ReportData, uint16_t* ReportSize);
|
||||
void CALLBACK_HID_Device_ProcessHIDReport(USB_ClassInfo_HID_Device_t* const HIDInterfaceInfo, const uint8_t ReportID,
|
||||
const void* ReportData, const uint16_t ReportSize);
|
||||
|
||||
|
|
Loading…
Reference in New Issue