diff options
Diffstat (limited to 'src/main.rs')
-rwxr-xr-x | src/main.rs | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/main.rs b/src/main.rs index 707feed..6cb4139 100755 --- a/src/main.rs +++ b/src/main.rs @@ -25,12 +25,6 @@ use led::LED; // global_asm!(include_str!("boot.S")); -#[derive(PartialEq)] -pub enum PollResult { - Ok, - WouldBlock, -} - #[entry] fn main(_hartid: usize) -> ! { let p = Peripherals::take().expect("couldn't take peripherals"); @@ -40,11 +34,7 @@ fn main(_hartid: usize) -> ! { let mut rcu = p.RCU.configure().freeze(); let mut afio = p.AFIO.constrain(&mut rcu); - - let timer = Timer::<pac::TIMER6>::timer6(p.TIMER6, Hertz(1), &mut rcu); let gpioa = p.GPIOA.split(&mut rcu); - let led = LED::new(gpioa.pa7); - let mut blink = blink::Task::new(timer, Hertz(5), led); // TODO: figure out how to use the usb serial on the start board. // @@ -59,10 +49,16 @@ fn main(_hartid: usize) -> ! { let (tx, _rx) = serial.split(); log::init(tx); + let timer = Timer::<pac::TIMER6>::timer6(p.TIMER6, Hertz(1), &mut rcu); + let led = LED::new(gpioa.pa7); + let mut blink = blink::Task::new(timer, Hertz(5), led); + loop { let mut can_sleep = true; - can_sleep &= blink.poll() == PollResult::WouldBlock; + if let Ok(_) = blink.poll() { + can_sleep = false; + } log!("yo!"); logln!(" mtv raps"); |