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: Only provide HSI48 & CRS in API for devices which have it #84

Closed pigrew closed 4 years ago

pigrew commented 4 years ago

This modifies the RCC module to provide the HSI48 and CRS API for devices which have it (based on the reference manual). The manual states that all devices with HSI48 have CRS. I don't envision it would often be used without USB, but there may be a use to someone.

I don't like how much replication of "cfg" statements this patch has. Let me know if there is a better way to code this (or if we should just leave the API in place for devices without the proper hardware).

EDIT: Another option would be to split the 0x1/0x2/0x8 "inner" module into one for devices with HSI48, and a second for devices without HSI48.