feat(stm32-f013): provide a const constructor on rcc::Config
				
					
				
			This commit is contained in:
		
							parent
							
								
									79b24bd35d
								
							
						
					
					
						commit
						4e6df17047
					
				| @ -126,13 +126,13 @@ pub struct Config { | |||||||
|     pub ls: super::LsConfig, |     pub ls: super::LsConfig, | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| impl Default for Config { | impl Config { | ||||||
|     fn default() -> Self { |     pub const fn new() -> Self { | ||||||
|         Self { |         Self { | ||||||
|             hsi: true, |             hsi: true, | ||||||
|             hse: None, |             hse: None, | ||||||
|             #[cfg(crs)] |             #[cfg(crs)] | ||||||
|             hsi48: Some(Default::default()), |             hsi48: Some(crate::rcc::Hsi48Config::new()), | ||||||
|             sys: Sysclk::HSI, |             sys: Sysclk::HSI, | ||||||
|             pll: None, |             pll: None, | ||||||
| 
 | 
 | ||||||
| @ -147,7 +147,7 @@ impl Default for Config { | |||||||
|             apb1_pre: APBPrescaler::DIV1, |             apb1_pre: APBPrescaler::DIV1, | ||||||
|             #[cfg(not(stm32f0))] |             #[cfg(not(stm32f0))] | ||||||
|             apb2_pre: APBPrescaler::DIV1, |             apb2_pre: APBPrescaler::DIV1, | ||||||
|             ls: Default::default(), |             ls: crate::rcc::LsConfig::new(), | ||||||
| 
 | 
 | ||||||
|             #[cfg(stm32f1)] |             #[cfg(stm32f1)] | ||||||
|             // ensure ADC is not out of range by default even if APB2 is maxxed out (36mhz)
 |             // ensure ADC is not out of range by default even if APB2 is maxxed out (36mhz)
 | ||||||
| @ -163,11 +163,17 @@ impl Default for Config { | |||||||
|             #[cfg(stm32f107)] |             #[cfg(stm32f107)] | ||||||
|             i2s3_src: I2s2src::SYS, |             i2s3_src: I2s2src::SYS, | ||||||
| 
 | 
 | ||||||
|             mux: Default::default(), |             mux: super::mux::ClockMux::default(), | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | impl Default for Config { | ||||||
|  |     fn default() -> Self { | ||||||
|  |         Self::new() | ||||||
|  |     } | ||||||
|  | } | ||||||
|  | 
 | ||||||
| /// Initialize and Set the clock frequencies
 | /// Initialize and Set the clock frequencies
 | ||||||
| pub(crate) unsafe fn init(config: Config) { | pub(crate) unsafe fn init(config: Config) { | ||||||
|     // Turn on the HSI
 |     // Turn on the HSI
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user