Enable RCC within the USART itself.

This commit is contained in:
Bob McWhirter 2021-06-30 09:57:27 -04:00
parent e1736114d4
commit 6a0b0f3162
2 changed files with 2 additions and 5 deletions

View file

@ -1,7 +1,7 @@
#![macro_use] #![macro_use]
#[cfg_attr(usart_v1, path = "v1.rs")] #[cfg_attr(usart_v1, path = "v1.rs")]
#[cfg_attr(usart_v2, path = "v2.rs")] //#[cfg_attr(usart_v2, path = "v2.rs")]
mod _version; mod _version;
use crate::peripherals; use crate::peripherals;
pub use _version::*; pub use _version::*;

View file

@ -63,14 +63,11 @@ impl<'d, T: Instance> Uart<'d, T> {
rx: impl Unborrow<Target = impl RxPin<T>>, rx: impl Unborrow<Target = impl RxPin<T>>,
tx: impl Unborrow<Target = impl TxPin<T>>, tx: impl Unborrow<Target = impl TxPin<T>>,
config: Config, config: Config,
//pclk_freq: u32,
) -> Self { ) -> Self {
unborrow!(inner, rx, tx); unborrow!(inner, rx, tx);
T::enable();
let pclk_freq = T::frequency(); 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. // TODO: better calculation, including error checking and OVER8 if possible.
let div = (pclk_freq.0 + (config.baudrate / 2)) / config.baudrate; let div = (pclk_freq.0 + (config.baudrate / 2)) / config.baudrate;