add systick disable
This commit is contained in:
parent
4c80907c0f
commit
472e43056d
1 changed files with 8 additions and 37 deletions
|
|
@ -239,6 +239,13 @@ fn systick_init(tick_freq_hz: usize) {
|
|||
w.set_stclk(ch32_hal::pac::systick::vals::Stclk::HCLK_DIV8); // HCLK/8 clock source
|
||||
});
|
||||
}
|
||||
fn systick_stop() {
|
||||
let r = &ch32_hal::pac::SYSTICK;
|
||||
// Reset SysTick
|
||||
r.ctlr().write(|w| {
|
||||
// Start with everything disabled
|
||||
});
|
||||
}
|
||||
|
||||
bind_interrupts!(struct Irqs {
|
||||
EXTI7_0 => Test;
|
||||
|
|
@ -561,6 +568,7 @@ use ch32_hal::timer::Channel;
|
|||
|
||||
// fn shutdown_main(p: Peripherals) {
|
||||
fn shutdown_main(p: hal::Peripherals) {
|
||||
systick_stop();
|
||||
// LED0 output setup
|
||||
let led0_pin = OutputOpenDrain::new(p.PC3, Level::Low, Default::default());
|
||||
let led1_pin = OutputOpenDrain::new(p.PD2, Level::High, Default::default());
|
||||
|
|
@ -595,43 +603,6 @@ fn shutdown_main(p: hal::Peripherals) {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loop {
|
||||
// unsafe {
|
||||
// #[allow(static_mut_refs)]
|
||||
// INPUT_FLAGS.sense_coin_flag.clear();
|
||||
// #[allow(static_mut_refs)]
|
||||
// INPUT_FLAGS.main_btn_flag.clear();
|
||||
// }
|
||||
// unsafe { system::enter_standby() };
|
||||
// riscv::asm::wfi();
|
||||
// unsafe {
|
||||
// #[allow(static_mut_refs)]
|
||||
// if (INPUT_FLAGS.sense_coin_flag.active()
|
||||
// || (INPUT_FLAGS.main_btn_flag.active() && main_btn_input.is_high_immediate()))
|
||||
// && app.should_wake()
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// let mut config = hal::Config::default();
|
||||
// config.rcc = hal::rcc::Config::SYSCLK_FREQ_48MHZ_HSI;
|
||||
// unsafe {
|
||||
// hal::rcc::init(config.rcc);
|
||||
// }
|
||||
// unsafe {
|
||||
// use hal::pac::Interrupt;
|
||||
// use qingke::interrupt::Priority;
|
||||
// use qingke_rt::CoreInterrupt;
|
||||
|
||||
// system::clear_interrupt(2, 6);
|
||||
|
||||
// qingke::pfic::set_priority(CoreInterrupt::SysTick as u8, Priority::P15 as u8);
|
||||
|
||||
// qingke::pfic::enable_interrupt(Interrupt::EXTI7_0 as u8);
|
||||
// qingke::pfic::enable_interrupt(CoreInterrupt::SysTick as u8);
|
||||
// }
|
||||
}
|
||||
|
||||
#[qingke_rt::entry]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue