Closed dlech closed 2 years ago
Thanks, this looks like a good optimisation. It might make it harder to update to newer HAL versions, but I guess we can deal with that when needed.
Would it be better to pass it in as a const USB_OTG_CfgTypeDef*
? Then it's guaranteed the caller won't change the struct, which retains semantics with pass-by-value.
Would it be better to pass it in as a
const USB_OTG_CfgTypeDef*
? Then it's guaranteed the caller won't change the struct, which retains semantics with pass-by-value.
Yes, that sounds like a good idea.
I have updated with the suggested change.
Thanks for updating. Merged in 5039e299bb92a79a777a97548f5722fd94c6425c through f0ff2b2346877fcc7841423a9cc930fcde11dfe1
This updates all HAL libraries to pass USB_OTG_CfgTypeDef by reference. USB_OTG_CfgTypeDef is a large struct that is being passed by value which uses extra stack and bigger code due to the extra copy of the struct.