From 508e18b26b450f2d2a70994ab2a179104fb65c5d Mon Sep 17 00:00:00 2001 From: Fergus Noble Date: Thu, 22 Sep 2011 13:52:43 -0700 Subject: [PATCH] Initial move of USART code to common, still needs some work. --- include/libopencm3/stm32/usart.h | 2 +- lib/{stm32f1 => stm32_common}/usart.c | 12 +++++------- 2 files changed, 6 insertions(+), 8 deletions(-) rename lib/{stm32f1 => stm32_common}/usart.c (94%) diff --git a/include/libopencm3/stm32/usart.h b/include/libopencm3/stm32/usart.h index df6bc089..51b96f24 100644 --- a/include/libopencm3/stm32/usart.h +++ b/include/libopencm3/stm32/usart.h @@ -294,7 +294,7 @@ /* --- Function prototypes ------------------------------------------------- */ -void usart_set_baudrate(u32 usart, u32 baud); +void usart_set_baudrate(u32 usart, u32 baud, u32 clock); void usart_set_databits(u32 usart, u32 bits); void usart_set_stopbits(u32 usart, u32 stopbits); void usart_set_parity(u32 usart, u32 parity); diff --git a/lib/stm32f1/usart.c b/lib/stm32_common/usart.c similarity index 94% rename from lib/stm32f1/usart.c rename to lib/stm32_common/usart.c index 73e450b2..026af3af 100644 --- a/lib/stm32f1/usart.c +++ b/lib/stm32_common/usart.c @@ -17,17 +17,15 @@ * along with this program. If not, see . */ -#include - #include -void usart_set_baudrate(u32 usart, u32 baud) +void usart_set_baudrate(u32 usart, u32 baud, u32 clock) { - u32 clock = rcc_ppre1_frequency; + //u32 clock = rcc_ppre1_frequency; - if (usart == USART1) { - clock = rcc_ppre2_frequency; - } + //if (usart == USART1) { + // clock = rcc_ppre2_frequency; + //} /* yes it is as simple as that. The reference manual is * talking about factional calculation but it seems to be only