Skip to content

Commit 46cdeaf

Browse files
dlechdpgeorge
authored andcommitted
WB_HAL/usb: Pass USB_OTG_CfgTypeDef by reference.
USB_OTG_CfgTypeDef is a large struct, so passing by reference should be more efficient in terms of stack usage and code size. Signed-off-by: David Lechner <[email protected]>
1 parent 451c71f commit 46cdeaf

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

STM32WBxx_HAL_Driver/Inc/stm32wbxx_ll_usb.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,8 @@ typedef struct
178178
*/
179179

180180

181-
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
182-
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg);
181+
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg);
182+
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg);
183183
HAL_StatusTypeDef USB_EnableGlobalInt(USB_TypeDef *USBx);
184184
HAL_StatusTypeDef USB_DisableGlobalInt(USB_TypeDef *USBx);
185185
HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode);

STM32WBxx_HAL_Driver/Src/stm32wbxx_hal_pcd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
194194
}
195195

196196
/* Init Device */
197-
(void)USB_DevInit(hpcd->Instance, hpcd->Init);
197+
(void)USB_DevInit(hpcd->Instance, &hpcd->Init);
198198

199199
hpcd->USB_Address = 0U;
200200
hpcd->State = HAL_PCD_STATE_READY;

STM32WBxx_HAL_Driver/Src/stm32wbxx_ll_usb.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* the configuration information for the specified USBx peripheral.
6262
* @retval HAL status
6363
*/
64-
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg)
64+
HAL_StatusTypeDef USB_CoreInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg)
6565
{
6666
/* Prevent unused argument(s) compilation warning */
6767
UNUSED(USBx);
@@ -148,7 +148,7 @@ HAL_StatusTypeDef USB_SetCurrentMode(USB_TypeDef *USBx, USB_ModeTypeDef mode)
148148
* the configuration information for the specified USBx peripheral.
149149
* @retval HAL status
150150
*/
151-
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, USB_CfgTypeDef cfg)
151+
HAL_StatusTypeDef USB_DevInit(USB_TypeDef *USBx, const USB_CfgTypeDef *cfg)
152152
{
153153
/* Prevent unused argument(s) compilation warning */
154154
UNUSED(cfg);

0 commit comments

Comments
 (0)