nixie-clock-firmware/src/application/gps.rs

27 lines
796 B
Rust

use nmea0183::ParseResult;
use stm32f1xx_hal::prelude::*;
use crate::application::App;
use crate::time;
impl App {
pub fn poll_gps(&mut self) -> () {
match self.serial.read() {
Ok(byte) => {
self.board_led.toggle().unwrap();
if let Some(result) = self.gps_parser.parse_from_byte(byte) {
match result {
Ok(ParseResult::GGA(Some(gga))) => {
time::set(&gga.time);
}
Ok(_) => {} // Some other sentences..
Err(_) => {} // Got parse error
}
}
}
Err(nb::Error::WouldBlock) => {}
Err(nb::Error::Other(_)) => {}
}
}
}