Trait cortex_m::interrupt::InterruptNumber

source ·
pub unsafe trait InterruptNumber: Copy {
    // Required method
    fn number(self) -> u16;
}
Expand description

Trait for enums of external interrupt numbers.

This trait should be implemented by a peripheral access crate (PAC) on its enum of available external interrupts for a specific device. Each variant must convert to a u16 of its interrupt number, which is its exception number - 16.

§Safety

This trait must only be implemented on enums of device interrupts. Each enum variant must represent a distinct value (no duplicates are permitted), and must always return the same value (do not change at runtime).

These requirements ensure safe nesting of critical sections.

Required Methods§

source

fn number(self) -> u16

Return the interrupt number associated with this variant.

See trait documentation for safety requirements.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<T: Nr + Copy> InterruptNumber for T

Implement InterruptNumber for the old bare_metal::Nr trait. This implementation is for backwards compatibility only and will be removed in cortex-m 0.8.