From 307cfe164910eccc70c086c083595d637c7fb987 Mon Sep 17 00:00:00 2001 From: Vegard Storheil Eriksen Date: Sat, 19 Nov 2011 20:02:14 +0100 Subject: Moved driver related files to a subdirectory. --- gps.h | 60 ------------------------------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 gps.h (limited to 'gps.h') diff --git a/gps.h b/gps.h deleted file mode 100644 index c37fc8a..0000000 --- a/gps.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef GPS_H -#define GPS_H - -#include "stm32.h" -#include "interrupt.h" -#include "thread.h" - -#include "pool.h" - -struct GPSMsg { - unsigned int n; - uint8_t buf[128]; - - GPSMsg() : n(0) {} -}; - -class GPS { - friend void interrupt(); - - private: - static GPS* self; - - void irq(); - - Pool msg_pool; - - P incomplete_msg; - volatile P complete_msg; - - volatile bool complete; - - public: - GPS() { - self = this; - } - - void enable() { - RCC.enable(RCC.USART3); - USART3.BRR = 7500; // 4800 baud - USART3.CR1 = 0x202c; - - Interrupt::enable(Interrupt::USART3); - } - - P read() { - while(!complete) { - Thread::yield(); - } - - complete = false; - - P msg = const_cast&>(complete_msg); - - const_cast&>(complete_msg).reset(); - - return msg; - } -}; - -#endif -- cgit v1.2.3