}
}
+fn next_view(view: View) -> View {
+ match view {
+ View::Time => View::Distance,
+ View::Distance => View::Time,
+ }
+}
+
+fn previous_view(view: View) -> View {
+ match view {
+ View::Time => View::Distance,
+ View::Distance => View::Time,
+ }
+}
+
fn reset_requested() -> bool {
let pta1 = gpio::get(gpio::GPIOA) & (1 << 1);
let pte25 = gpio::get(gpio::GPIOE) & (1 << 25);
logger.init();
let mut pta12 = button::Button::new(gpio::GPIOA, 1 << 12);
+ let mut pte24 = button::Button::new(gpio::GPIOE, 1 << 24);
+ let mut pta01 = button::Button::new(gpio::GPIOA, 1 << 1);
let mut is_recording = false;
let mut gps = gps::Gps::new();
model.reset();
}
+ let new_view = if pte24.has_been_held_for_ms(250) {
+ previous_view(view)
+ } else if pta01.has_been_held_for_ms(250) {
+ next_view(view)
+ } else {
+ view
+ };
+
+ if view != new_view {
+ view = new_view;
+
+ match view {
+ View::Time => time_view.invalidate(),
+ View::Distance => distance_view.invalidate(),
+ }
+ }
+
if reset_requested() {
nvic::system_reset();
}