CH579M_Small_Rust_Hello/src/main.rs

31 lines
567 B
Rust

#![no_std]
#![no_main]
use panic_halt as _;
use cortex_m::asm;
use cortex_m::peripheral::syst;
use cortex_m_rt::entry;
use ch57x_pac;
#[entry]
fn main() -> ! {
let core_peripherals = cortex_m::Peripherals::take().unwrap();
let peripherals = ch57x_pac::Peripherals::take().unwrap();
let mut systick = core_peripherals.SYST;
systick.set_clock_source(syst::SystClkSource::Core);
systick.set_reload(16_000);
systick.clear_current();
systick.enable_counter();
while !systick.has_wrapped() {
asm::nop();
}
loop {}
}