[−][src]Function interrupture::scope
pub fn scope<'a, IC, F, C, R>(ic: IC, default_handler: F, code: C) -> R where
IC: InterruptController,
F: FnMut(u8) + Send,
C: FnOnce(&mut InterruptTable<'a, IC>) -> R,
Creates a new scope, to guarantee that the InterruptTable
constructor is called.
Examples
fn main(hw: board::Hardware) -> ! { // Extract hardware let board::Hardware { rcc, pwr, flash, nvic, .. } = hw; // Configure system clock system_clock::init(rcc, pwr, flash); use stm32f7::interrupts::interrupt_request::InterruptRequest::Tim7; use interrupts::Priority::P1; // Open scope with interrupt support interrupts::scope(nvic, |irq| { hprintln!("Default handler: {}", irq) }, |interrupt_table| { let _ = interrupt_table.register(Tim7, P1, || { hprintln!("Interrupt handler for Tim7"); }); }); loop{} }
Panics
Panics if an interrupt is enabled and is not disabled after use in code()