application: Extract time and position from GPS NMEA messages.
[gps-watch.git] / src / application / main.rs
index edb234eae4fafe355e3541c1dbdfb9cb80c52ddc..dbd748c8e28013e25f5c62afdd8f24d68251ba86 100644 (file)
@@ -39,6 +39,7 @@ use common::i2c;
 use common::uart;
 use common::usb_serial;
 use common::display;
+use common::gps;
 
 extern {
     fn enable_interrupts();
@@ -99,11 +100,13 @@ pub unsafe extern "C" fn _start() -> ! {
 
     nvic::enable_irq(12); // UART0
 
+    let mut gps = gps::Gps::new();
+
     loop {
-        systick::delay_ms(1000);
+        let mut tap = gps::TimeAndPos::new();
 
-        cdc_tx_buf.write(b".\n");
-        cdc_tx_buf.flush();
+        while gps.update(&mut tap) {
+        }
 
         if (gpio::get(gpio::GPIOA) & (1 << 12)) == 0 {
             nvic::system_reset();