49 lines
996 B
Rust
49 lines
996 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, rtt_init_print},
|
|
};
|
|
#[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() -> ! {
|
|
|
|
// RTT does not rely on any peripherals, can be set up immidiately
|
|
#[cfg(feature = "RTT")]
|
|
rtt_init_print!();
|
|
|
|
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);
|
|
}
|
|
}
|