@@ -22,10 +22,7 @@ pub trait RccExt {
2222 fn constrain ( self ) -> Rcc ;
2323
2424 /// Constrains the `RCC` peripheral and apply clock configuration
25- fn freeze ( self , rcc_cfg : Config , acr : & mut ACR ) -> Rcc ;
26-
27- /// Constrains the `RCC` peripheral and apply clock configuration
28- fn freeze_raw ( self , rcc_cfg : RawConfig , acr : & mut ACR ) -> Rcc ;
25+ fn freeze ( self , rcc_cfg : impl Into < RawConfig > , acr : & mut ACR ) -> Rcc ;
2926}
3027
3128impl RccExt for RCC {
@@ -36,13 +33,9 @@ impl RccExt for RCC {
3633 }
3734 }
3835
39- fn freeze ( self , rcc_cfg : Config , acr : & mut ACR ) -> Rcc {
36+ fn freeze ( self , rcc_cfg : impl Into < RawConfig > , acr : & mut ACR ) -> Rcc {
4037 self . constrain ( ) . freeze ( rcc_cfg, acr)
4138 }
42-
43- fn freeze_raw ( self , rcc_cfg : RawConfig , acr : & mut ACR ) -> Rcc {
44- self . constrain ( ) . freeze_raw ( rcc_cfg, acr)
45- }
4639}
4740
4841/// Constrained RCC peripheral
@@ -214,13 +207,8 @@ impl Rcc {
214207 /// let clocks = rcc.cfgr.freeze(&mut flash.acr);
215208 /// ```
216209 #[ inline( always) ]
217- pub fn freeze ( self , config : Config , acr : & mut ACR ) -> Self {
218- let cfg = RawConfig :: from_cfgr ( config) ;
219- self . freeze_raw ( cfg, acr)
220- }
221-
222- #[ inline( always) ]
223- pub fn freeze_raw ( self , cfg : RawConfig , acr : & mut ACR ) -> Self {
210+ pub fn freeze ( self , cfg : impl Into < RawConfig > , acr : & mut ACR ) -> Self {
211+ let cfg = cfg. into ( ) ;
224212 let clocks = cfg. get_clocks ( ) ;
225213 // adjust flash wait states
226214 #[ cfg( any( feature = "stm32f103" , feature = "connectivity" ) ) ]
@@ -631,6 +619,13 @@ pub type UsbPre = rcc::cfgr::USBPRE;
631619pub type UsbPre = rcc:: cfgr:: OTGFSPRE ;
632620pub type AdcPre = rcc:: cfgr:: ADCPRE ;
633621
622+ impl From < Config > for RawConfig {
623+ #[ inline( always) ]
624+ fn from ( cfgr : Config ) -> Self {
625+ Self :: from_cfgr ( cfgr)
626+ }
627+ }
628+
634629impl RawConfig {
635630 pub const fn from_cfgr ( cfgr : Config ) -> Self {
636631 let hse = cfgr. hse ;
0 commit comments