summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
authorVegard Storheil Eriksen <zyp@jvnv.net>2011-10-10 01:13:52 +0200
committerVegard Storheil Eriksen <zyp@jvnv.net>2011-10-10 01:13:52 +0200
commit261e6be038754388212e7a7b69da1318d6a171d2 (patch)
tree8788bffbb8248aeab9ed07c326445bac491633b7 /main.cpp
parentf8e706f8bc5a69f5b8134624516a3597d335685e (diff)
Add GPS code.
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/main.cpp b/main.cpp
index 471e40e..c95731f 100644
--- a/main.cpp
+++ b/main.cpp
@@ -11,6 +11,7 @@
#include "usart.h"
#include "xbee.h"
+#include "gps.h"
template<class T>
inline void saturate(T& var, T absmax) {
@@ -82,6 +83,22 @@ uint32_t thstack[1024];
Thread thread(thstack, sizeof(thstack), threadmain);
+GPS gps;
+
+void gps_thread_main() {
+ while(1) {
+ P<GPSMsg> msg = gps.read();
+
+ if(msg->n < 128) {
+ xbee_send(2, msg->n, msg->buf);
+ }
+ }
+}
+
+uint32_t gps_stack[256];
+
+Thread gps_thread(gps_stack, sizeof(gps_stack), gps_thread_main);
+
int main() {
// Initialize system timer.
Time::init();
@@ -124,8 +141,10 @@ int main() {
PID pid_yaw(6000, 0, 0);
usart_enable();
+ gps.enable();
thread.start();
+ gps_thread.start();
while(1) {
// Wait for a new update.