From d0a7ee402141d6703218765c36a47003538168d1 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 3 Dec 2011 20:18:53 +0100 Subject: Moved USART register definitions into seperate header and added abstraction layer. --- drivers/gps.cpp | 4 ++-- drivers/gps.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers') 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() { 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&>(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); } -- cgit v1.2.3