Enable RCC within the USART itself.
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| #![macro_use] | ||||
|  | ||||
| #[cfg_attr(usart_v1, path = "v1.rs")] | ||||
| #[cfg_attr(usart_v2, path = "v2.rs")] | ||||
| //#[cfg_attr(usart_v2, path = "v2.rs")] | ||||
| mod _version; | ||||
| use crate::peripherals; | ||||
| pub use _version::*; | ||||
|   | ||||
| @@ -63,14 +63,11 @@ impl<'d, T: Instance> Uart<'d, T> { | ||||
|         rx: impl Unborrow<Target = impl RxPin<T>>, | ||||
|         tx: impl Unborrow<Target = impl TxPin<T>>, | ||||
|         config: Config, | ||||
|         //pclk_freq: u32, | ||||
|     ) -> Self { | ||||
|         unborrow!(inner, rx, tx); | ||||
|  | ||||
|         T::enable(); | ||||
|         let pclk_freq = T::frequency(); | ||||
|         //let pclk_freq = 16_000_000; | ||||
|  | ||||
|         // TODO: enable in RCC | ||||
|  | ||||
|         // TODO: better calculation, including error checking and OVER8 if possible. | ||||
|         let div = (pclk_freq.0 + (config.baudrate / 2)) / config.baudrate; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user