diff --git a/include/usbd_gs_can.h b/include/usbd_gs_can.h index b211f58..a8b6931 100644 --- a/include/usbd_gs_can.h +++ b/include/usbd_gs_can.h @@ -66,7 +66,6 @@ void USBD_GS_CAN_SetChannel(USBD_HandleTypeDef *pdev, uint8_t channel, can_data_ void USBD_GS_CAN_SuspendCallback(USBD_HandleTypeDef *pdev); void USBD_GS_CAN_ResumeCallback(USBD_HandleTypeDef *pdev); bool USBD_GS_CAN_TxReady(USBD_HandleTypeDef *pdev); -uint8_t USBD_GS_CAN_PrepareReceive(USBD_HandleTypeDef *pdev); bool USBD_GS_CAN_CustomDeviceRequest(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); bool USBD_GS_CAN_CustomInterfaceRequest(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req); diff --git a/src/usbd_gs_can.c b/src/usbd_gs_can.c index 2e484b9..6cc3fc6 100644 --- a/src/usbd_gs_can.c +++ b/src/usbd_gs_can.c @@ -288,6 +288,12 @@ static const struct gs_device_bt_const USBD_GS_CAN_btconst = { 1, // brp increment; }; +static inline uint8_t USBD_GS_CAN_PrepareReceive(USBD_HandleTypeDef *pdev) +{ + USBD_GS_CAN_HandleTypeDef *hcan = (USBD_GS_CAN_HandleTypeDef*)pdev->pClassData; + return USBD_LL_PrepareReceive(pdev, GSUSB_ENDPOINT_OUT, (uint8_t*)hcan->from_host_buf, sizeof(*hcan->from_host_buf)); +} + /* It's unclear from the documentation, but it appears that the USB library is * not safely reentrant. It attempts to signal errors via return values if it is * reentered, but that code is not interrupt-safe and the error values are @@ -652,12 +658,6 @@ static uint8_t *USBD_GS_CAN_GetCfgDesc(uint16_t *len) return USBD_DescBuf; } -inline uint8_t USBD_GS_CAN_PrepareReceive(USBD_HandleTypeDef *pdev) -{ - USBD_GS_CAN_HandleTypeDef *hcan = (USBD_GS_CAN_HandleTypeDef*)pdev->pClassData; - return USBD_LL_PrepareReceive(pdev, GSUSB_ENDPOINT_OUT, (uint8_t*)hcan->from_host_buf, sizeof(*hcan->from_host_buf)); -} - bool USBD_GS_CAN_TxReady(USBD_HandleTypeDef *pdev) { USBD_GS_CAN_HandleTypeDef *hcan = (USBD_GS_CAN_HandleTypeDef*)pdev->pClassData;