Release v2.11.4

This commit is contained in:
slimih
2025-04-15 10:28:24 +01:00
parent 0b06460a43
commit 2a0a3521ac
27 changed files with 408 additions and 167 deletions

View File

@@ -79,10 +79,12 @@ extern "C" {
#define USBD_CUSTOMHID_OUTREPORT_BUF_SIZE 0x02U
#define USBD_CUSTOM_HID_REPORT_DESC_SIZE 163U
/* #define USBD_CUSTOMHID_REPORT_DESC_SIZE_ENABLED */
/* #define USBD_CUSTOMHID_CTRL_REQ_GET_REPORT_ENABLED */
/* #define USBD_CUSTOMHID_OUT_PREPARE_RECEIVE_DISABLED */
/* #define USBD_CUSTOMHID_EP0_OUT_PREPARE_RECEIVE_DISABLED */
/* #define USBD_CUSTOMHID_CTRL_REQ_COMPLETE_CALLBACK_ENABLED */
/* #define USBD_CUSTOMHID_REPORT_BUFFER_EVENT_ENABLED */
/* VIDEO Class Config */
#define UVC_1_1 /* #define UVC_1_0 */

View File

@@ -305,12 +305,13 @@ typedef struct
/* USB Device handle structure */
typedef struct
{
uint32_t status;
uint32_t total_length;
uint32_t rem_length;
uint32_t maxpacket;
uint16_t is_used;
uint16_t bInterval;
uint32_t bInterval;
uint16_t maxpacket;
uint8_t status;
uint8_t is_used;
uint8_t *pbuffer;
} USBD_EndpointTypeDef;
#ifdef USE_USBD_COMPOSITE

View File

@@ -25,6 +25,10 @@
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/*
* User to provide a unique ID to define the USB device serial number
* The use of UID_BASE register can be considered as an example
*/
#define DEVICE_ID1 (UID_BASE)
#define DEVICE_ID2 (UID_BASE + 0x4U)
#define DEVICE_ID3 (UID_BASE + 0x8U)

View File

@@ -296,7 +296,7 @@ USBD_StatusTypeDef USBD_RegisterClassComposite(USBD_HandleTypeDef *pdev, USBD_Cl
*/
USBD_StatusTypeDef USBD_UnRegisterClassComposite(USBD_HandleTypeDef *pdev)
{
USBD_StatusTypeDef ret = USBD_FAIL;
USBD_StatusTypeDef ret = USBD_OK;
uint8_t idx1;
uint8_t idx2;
@@ -590,6 +590,8 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
USBD_StatusTypeDef ret = USBD_OK;
uint8_t idx;
UNUSED(pdata);
if (epnum == 0U)
{
pep = &pdev->ep_out[0];
@@ -599,8 +601,9 @@ USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev,
if (pep->rem_length > pep->maxpacket)
{
pep->rem_length -= pep->maxpacket;
pep->pbuffer += pep->maxpacket;
(void)USBD_CtlContinueRx(pdev, pdata, MIN(pep->rem_length, pep->maxpacket));
(void)USBD_CtlContinueRx(pdev, pep->pbuffer, MAX(pep->rem_length, pep->maxpacket));
}
else
{
@@ -685,6 +688,8 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
USBD_StatusTypeDef ret;
uint8_t idx;
UNUSED(pdata);
if (epnum == 0U)
{
pep = &pdev->ep_in[0];
@@ -694,8 +699,9 @@ USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev,
if (pep->rem_length > pep->maxpacket)
{
pep->rem_length -= pep->maxpacket;
pep->pbuffer += pep->maxpacket;
(void)USBD_CtlContinueSendData(pdev, pdata, pep->rem_length);
(void)USBD_CtlContinueSendData(pdev, pep->pbuffer, pep->rem_length);
/* Prepare endpoint for premature end of transfer */
(void)USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U);

View File

@@ -65,7 +65,7 @@ USBD_DescriptorsTypeDef Class_Desc =
USBD_Class_ConfigStrDescriptor,
USBD_Class_InterfaceStrDescriptor,
#if (USBD_CLASS_USER_STRING_DESC == 1)
USBD_CLASS_UserStrDescriptor,
USBD_Class_UserStrDescriptor,
#endif /* USB_CLASS_USER_STRING_DESC */
#if ((USBD_LPM_ENABLED == 1) || (USBD_CLASS_BOS_ENABLED == 1))

View File

@@ -89,6 +89,7 @@ USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev,
/* Set EP0 State */
pdev->ep0_state = USBD_EP0_DATA_IN;
pdev->ep_in[0].total_length = len;
pdev->ep_in[0].pbuffer = pbuf;
#ifdef USBD_AVOID_PACKET_SPLIT_MPS
pdev->ep_in[0].rem_length = 0U;
@@ -133,6 +134,7 @@ USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev,
/* Set EP0 State */
pdev->ep0_state = USBD_EP0_DATA_OUT;
pdev->ep_out[0].total_length = len;
pdev->ep_out[0].pbuffer = pbuf;
#ifdef USBD_AVOID_PACKET_SPLIT_MPS
pdev->ep_out[0].rem_length = 0U;