[−][src]Macro irq::scoped_interrupts
Hooks interrupts and makes them available to the scope
API.
In order to hook the interrupts, you need to provide a macro to apply to the interrupt veneers.
This is generally architecture- or even MCU-specific. On Cortex-M devices, this should usually
be the #[interrupt]
macro exported by the device-specific PAC.
It is not necessary to hook all interrupts. Only those that should be made available to the
scope
API are required. Since every hooked interrupt comes with a cost in code and data
size, it is advisable to only hook the interrupts needed by the application.
Examples
In this example, an svd2rust-generated Peripheral Access Crate mock_pac
provides the
interrupts that can be hooked using the #[interrupt]
macro:
scoped_interrupts! { enum Interrupt { INT0, } use #[interrupt]; }
Also refer to examples/mock-pac.rs
for a standalone version with more comments.