45 lines
855 B
Rust
45 lines
855 B
Rust
#![no_main]
|
|
#![no_std]
|
|
|
|
use cortex_m_rt::entry;
|
|
use log::info;
|
|
use stm32f4xx_hal::pac::{CorePeripherals, Peripherals};
|
|
|
|
mod device;
|
|
mod laser_diode;
|
|
use device::{boot::bootup, log_setup, sys_timer};
|
|
|
|
// If RTT is used, print panic info through RTT
|
|
#[cfg(feature = "RTT")]
|
|
use {
|
|
core::panic::PanicInfo,
|
|
rtt_target::rprintln,
|
|
};
|
|
#[cfg(feature = "RTT")]
|
|
#[panic_handler]
|
|
fn panic(info: &PanicInfo) -> ! {
|
|
rprintln!("{}", info);
|
|
loop {}
|
|
}
|
|
// Otherwise use panic halt
|
|
#[cfg(not(feature = "RTT"))]
|
|
use panic_halt as _;
|
|
|
|
#[entry]
|
|
fn main() -> ! {
|
|
|
|
log_setup::init_log();
|
|
info!("Kirdy init");
|
|
|
|
let core_perif = CorePeripherals::take().unwrap();
|
|
let perif = Peripherals::take().unwrap();
|
|
|
|
let mut wd = bootup(core_perif, perif);
|
|
|
|
loop {
|
|
wd.feed();
|
|
info!("looping");
|
|
sys_timer::sleep(10);
|
|
}
|
|
}
|