summaryrefslogtreecommitdiff
path: root/hal
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 18:48:57 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-11-19 19:47:07 +0100
commit501b5765964affe9b48c88a5b580bd321170cc38 (patch)
treecb769d45cc3e6edabdb7faf5172d50d06e81584e /hal
parent9363133fd8880d60cfa01c4e0e7e183fb2b4079e (diff)
Avoid symbol conflicts from usart.h and xbee.h.
Diffstat (limited to 'hal')
-rw-r--r--hal/usart.cpp7
-rw-r--r--hal/usart.h12
2 files changed, 12 insertions, 7 deletions
diff --git a/hal/usart.cpp b/hal/usart.cpp
new file mode 100644
index 0000000..c446302
--- /dev/null
+++ b/hal/usart.cpp
@@ -0,0 +1,7 @@
+#include "usart.h"
+
+template<>
+void interrupt<Interrupt::USART1>() {
+ USART1.DR;
+ //GPIOB.ODR ^= 1 << 1;
+}
diff --git a/hal/usart.h b/hal/usart.h
index 8fde39a..484d89e 100644
--- a/hal/usart.h
+++ b/hal/usart.h
@@ -1,13 +1,11 @@
#ifndef USART_H
#define USART_H
-template<>
-void interrupt<Interrupt::USART1>() {
- USART1.DR;
- //GPIOB.ODR ^= 1 << 1;
-}
+#include "stm32.h"
+#include "interrupt.h"
+#include "thread.h"
-void usart_enable() {
+inline void usart_enable() {
RCC.enable(RCC.USART1);
USART1.BRR = 625; // 115200 baud
USART1.CR1 = 0x202c;
@@ -15,7 +13,7 @@ void usart_enable() {
Interrupt::enable(Interrupt::USART1);
}
-void usart_send(uint8_t data) {
+inline void usart_send(uint8_t data) {
while(!(USART1.SR & 0x80)) {
Thread::yield();
} // Wait for TXE.