stm32-rs / stm32f0xx-hal

A Rust `embedded-hal` implementation for all MCUs in the STM32 F0 family
BSD Zero Clause License
134 stars 59 forks source link

RCC: USB source switching code. #85

Closed pigrew closed 4 years ago

pigrew commented 4 years ago

This adds an RCC API feature to set the USB clock source. This is necessary for STM32F070 and also if a crystal is desired to be used for a USB clock (instead of the RCC).

Similar to yesterday's patch, this has lots of cfg attributes to control which features are available for the various MCU models. It looks like we could create a new attribute macro like cfg_has_usb to apply the proper device list, but I'm leaning towards the simplicity of what this PRcontains.

This does not yet make USB F070 USB work (yet), as the PLL multipliers are not calculated correctly (related to #78), but it is another step in that direction.

This should close #83.

pigrew commented 4 years ago

@therealprof

Could you review this PR? I think with this one, and fixing PLL multiplier calculation, USB will be functional on the F070.

pigrew commented 4 years ago

@therealprof

A changelog entry has been added (and I squashed/force-pushed the change). Thanks!

therealprof commented 4 years ago

No, thank you!