application: Extract time and position from GPS NMEA messages.
authorTilman Sauerbeck <tilman@code-monkey.de>
Mon, 30 Dec 2019 10:39:26 +0000 (11:39 +0100)
committerTilman Sauerbeck <tilman@code-monkey.de>
Mon, 6 Jan 2020 09:45:34 +0000 (10:45 +0100)
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();