diff options
| author | Bob McWhirter <[email protected]> | 2021-06-30 09:57:27 -0400 |
|---|---|---|
| committer | Bob McWhirter <[email protected]> | 2021-06-30 09:57:27 -0400 |
| commit | 6a0b0f31621d9a494665de88f102566cd606c8ff (patch) | |
| tree | 8102c10c7dfade5ca76889911bee3db8ed3f78fe | |
| parent | e1736114d4862eba626d2fb5e5b89d0d9bd54752 (diff) | |
Enable RCC within the USART itself.
| -rw-r--r-- | embassy-stm32/src/usart/mod.rs | 2 | ||||
| -rw-r--r-- | embassy-stm32/src/usart/v1.rs | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/embassy-stm32/src/usart/mod.rs b/embassy-stm32/src/usart/mod.rs index a75793f84..e486a5d4a 100644 --- a/embassy-stm32/src/usart/mod.rs +++ b/embassy-stm32/src/usart/mod.rs | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #![macro_use] | 1 | #![macro_use] |
| 2 | 2 | ||
| 3 | #[cfg_attr(usart_v1, path = "v1.rs")] | 3 | #[cfg_attr(usart_v1, path = "v1.rs")] |
| 4 | #[cfg_attr(usart_v2, path = "v2.rs")] | 4 | //#[cfg_attr(usart_v2, path = "v2.rs")] |
| 5 | mod _version; | 5 | mod _version; |
| 6 | use crate::peripherals; | 6 | use crate::peripherals; |
| 7 | pub use _version::*; | 7 | pub use _version::*; |
diff --git a/embassy-stm32/src/usart/v1.rs b/embassy-stm32/src/usart/v1.rs index 37b325d8f..6c5a12441 100644 --- a/embassy-stm32/src/usart/v1.rs +++ b/embassy-stm32/src/usart/v1.rs | |||
| @@ -63,14 +63,11 @@ impl<'d, T: Instance> Uart<'d, T> { | |||
| 63 | rx: impl Unborrow<Target = impl RxPin<T>>, | 63 | rx: impl Unborrow<Target = impl RxPin<T>>, |
| 64 | tx: impl Unborrow<Target = impl TxPin<T>>, | 64 | tx: impl Unborrow<Target = impl TxPin<T>>, |
| 65 | config: Config, | 65 | config: Config, |
| 66 | //pclk_freq: u32, | ||
| 67 | ) -> Self { | 66 | ) -> Self { |
| 68 | unborrow!(inner, rx, tx); | 67 | unborrow!(inner, rx, tx); |
| 69 | 68 | ||
| 69 | T::enable(); | ||
| 70 | let pclk_freq = T::frequency(); | 70 | let pclk_freq = T::frequency(); |
| 71 | //let pclk_freq = 16_000_000; | ||
| 72 | |||
| 73 | // TODO: enable in RCC | ||
| 74 | 71 | ||
| 75 | // TODO: better calculation, including error checking and OVER8 if possible. | 72 | // TODO: better calculation, including error checking and OVER8 if possible. |
| 76 | let div = (pclk_freq.0 + (config.baudrate / 2)) / config.baudrate; | 73 | let div = (pclk_freq.0 + (config.baudrate / 2)) / config.baudrate; |
