STM32CubeIDE: Configure USB HID CUSTOM_HID_ReportDesc_FS structure
The CUSTOM_HID_ReportDesc_FS is defined in usbd_custome_hid_if.c as
~~~
__ALIGN_BEGIN static uint8_t CUSTOM_HID_ReportDesc_FS[USBD_CUSTOM_HID_REPORT_DESC_SIZE] __ALIGN_END
~~~
The question the arises where to define USBD_CUSTOM_HID_REPORT_DESC_SIZE to match the actual report size in custom project, because it turns out that when usbd_custome_hid_if.c is built it invokes (in order)
- usbd_conf.h which unconditionally defines it to 2U
- usbd_customhid.h which conditionally defines it to 163U (Why ??????)
- usbd_custome_hid_if.h which doesn't define any value.
What is worse, usbd_customhid.c uses USBD_CUSTOM_HID_REPORT_DESC_SIZE to build USBD_CUSTOM_HID_CfgFSDesc, USBD_CUSTOM_HID_CfgHSDesc, USBD_CUSTOM_HID_OtherSpeedCfgDesc and USBD_CUSTOM_HID_Desc based on definitions in usbd_customhid.h . This means that there is a dependancy from the application into the Middleware code.
I've added a definition of USBD_CUSTOM_HID_REPORT_DESC_SIZE before usbd_custome_hid_if.h is included, but build of usbd_custome_hid_if.c then fails because it is already unconditionally defined in usbd_conf.h .
So, what is the correct way of defining USBD_CUSTOM_HID_REPORT_DESC_SIZE so that both usbd_customhid.c and usbd_custome_hid_if.c are provided with correct values ?
