summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-12-03 20:18:53 +0100
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-12-03 20:18:53 +0100
commitd0a7ee402141d6703218765c36a47003538168d1 (patch)
tree4943107590772281dc78937e096c280d23147ecd /drivers
parent229fd5405eef950e60cae3b6f446c146f38a2e13 (diff)
Moved USART register definitions into seperate header and added abstraction layer.
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gps.cpp4
-rw-r--r--drivers/gps.h6
2 files changed, 5 insertions, 5 deletions
diff --git a/drivers/gps.cpp b/drivers/gps.cpp
index 1ae3684..cdbb7ad 100644
--- a/drivers/gps.cpp
+++ b/drivers/gps.cpp
@@ -9,7 +9,7 @@ void interrupt<Interrupt::USART3>() {
void GPS::irq() {
- uint8_t c = USART3.DR;
+ uint8_t c = USART3.recv();
if(!incomplete_msg) {
incomplete_msg = msg_pool.create();
@@ -31,7 +31,7 @@ void GPS::irq() {
incomplete_msg->buf[incomplete_msg->n++] = c;
if(c == '\n') {
- GPIOB.ODR ^= 1 << 1;
+ //GPIOB.ODR ^= 1 << 1;
const_cast<P<GPSMsg>&>(complete_msg) = incomplete_msg;
incomplete_msg.reset();
diff --git a/drivers/gps.h b/drivers/gps.h
index 786b719..16a971b 100644
--- a/drivers/gps.h
+++ b/drivers/gps.h
@@ -2,7 +2,7 @@
#define GPS_H
#include "rcc.h"
-#include "stm32.h"
+#include "usart.h"
#include "interrupt.h"
#include "thread.h"
@@ -37,8 +37,8 @@ class GPS {
void enable() {
RCC.enable(RCC.USART3);
- USART3.BRR = 7500; // 4800 baud
- USART3.CR1 = 0x202c;
+ USART3.set_baudrate(4800);
+ USART3.enable();
Interrupt::enable(Interrupt::USART3);
}