Skip to content
Snippets Groups Projects
Select Git revision
  • f98b2a65ae6701bf8eac1d4742e1cb9f288daaa3
  • master default protected
  • home_exam
  • wip
4 results

main5.rs

Blame
  • Forked from Per Lindgren / D7050E
    Source project has a limited visibility.
    loop.rs 527 B
    //! Simple loop to calculate the sum of integers 0..10
    #![deny(unsafe_code)]
    #![feature(proc_macro)]
    #![no_std]
    
    extern crate cortex_m;
    extern crate cortex_m_rtfm as rtfm;
    extern crate stm32f40x;
    
    #[macro_use]
    extern crate cortex_m_debug;
    
    use rtfm::app;
    
    app! {
        device: stm32f40x,
    }
    
    fn init(_p: init::Peripherals) {
        let mut sum = 0;
        for i in 0..10 {
            ipln!("i = {}", i);
            sum += i;
        }
        ipln!("Sum 0..10 = {}", sum);
    }
    
    #[inline(never)]
    fn idle() -> ! {
        loop {
            rtfm::wfi();
        }
    }