aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFergus Noble2011-09-22 13:52:43 -0700
committerFergus Noble2011-09-22 13:52:43 -0700
commit508e18b26b450f2d2a70994ab2a179104fb65c5d (patch)
tree750ab4ab34adb651df85f1952ab68621b00282e8
parent551d069ed3e5fd5f2f25eae8bd0980905835002a (diff)
Initial move of USART code to common, still needs some work.
-rw-r--r--include/libopencm3/stm32/usart.h2
-rw-r--r--lib/stm32_common/usart.c (renamed from lib/stm32f1/usart.c)12
2 files changed, 6 insertions, 8 deletions
diff --git a/include/libopencm3/stm32/usart.h b/include/libopencm3/stm32/usart.h
index df6bc08..51b96f2 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
index 73e450b..026af3a 100644
--- a/lib/stm32f1/usart.c
+++ b/lib/stm32_common/usart.c
@@ -17,17 +17,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <libopencm3/stm32/f1/rcc.h>
-
#include <libopencm3/stm32/usart.h>
-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