Loading lib/src/lib.rs +4 −3 Original line number Diff line number Diff line Loading @@ -97,11 +97,12 @@ impl<'a> Timer<'a> { fn add_seconds(&mut self, seconds: u16) { let new_countdown = self.state.countdown.unwrap_or(0) + seconds; if new_countdown == 0 { return } // short circuit if this is the case self.state.countdown = Some(new_countdown); // Start countdown if self.state.countdown.is_none() { // If not currently counting down - start system timer self.ashi.start_syst(); } self.state.countdown = Some(new_countdown); } } #[cfg(test)] Loading main/src/main.rs +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ extern crate lib; mod blue_pill_ashi; // use core::fmt::Write; // use cortex_m_semihosting::hio::{self, HStdout}; // use cortex_m_semihosting::hio::{self};//, HStdout}; use cortex_m::peripheral::syst::SystClkSource; use rtfm::{app, Threshold}; use hal::prelude::*; Loading Loading @@ -106,6 +106,8 @@ fn init(mut p: init::Peripherals, _r: init::Resources) -> init::LateResources { // -------------------------------------------------------- // writeln!(hio::hstdout().unwrap(), "hsitrim: {:?}", rcc.cr.read().hsitrim().bits()).unwrap(); init::LateResources { LED_PIN: led, // STDOUT: hio::hstdout().unwrap(), Loading Loading
lib/src/lib.rs +4 −3 Original line number Diff line number Diff line Loading @@ -97,11 +97,12 @@ impl<'a> Timer<'a> { fn add_seconds(&mut self, seconds: u16) { let new_countdown = self.state.countdown.unwrap_or(0) + seconds; if new_countdown == 0 { return } // short circuit if this is the case self.state.countdown = Some(new_countdown); // Start countdown if self.state.countdown.is_none() { // If not currently counting down - start system timer self.ashi.start_syst(); } self.state.countdown = Some(new_countdown); } } #[cfg(test)] Loading
main/src/main.rs +3 −1 Original line number Diff line number Diff line Loading @@ -15,7 +15,7 @@ extern crate lib; mod blue_pill_ashi; // use core::fmt::Write; // use cortex_m_semihosting::hio::{self, HStdout}; // use cortex_m_semihosting::hio::{self};//, HStdout}; use cortex_m::peripheral::syst::SystClkSource; use rtfm::{app, Threshold}; use hal::prelude::*; Loading Loading @@ -106,6 +106,8 @@ fn init(mut p: init::Peripherals, _r: init::Resources) -> init::LateResources { // -------------------------------------------------------- // writeln!(hio::hstdout().unwrap(), "hsitrim: {:?}", rcc.cr.read().hsitrim().bits()).unwrap(); init::LateResources { LED_PIN: led, // STDOUT: hio::hstdout().unwrap(), Loading