1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
use crate::pac::interrupt; pub(super) static mut CLOSURE: Option<*const dyn Fn()> = None; pub fn dispatch() { unsafe { if let Some(func) = CLOSURE { (*func)() } } } // ADC 中断服务函数 #[interrupt] fn ADC_COMP() { // ADC1 的中断 eoc critical_section::with(|_cs| { dispatch(); }) }