take_exception!() { /* proc-macro */ }
Expand description

Return an instance of an unnameable struct that implements ExceptionHandle, which is bound to the exception specified by exception.

exception may be any of the variants of Exception (from cortex_m), except for Exception::HardFault

The returned struct has the following features:

  • Calling register more than once for the same Exception panics.

Usage

use cortex_m_interrupt::take_exception;

// The value returned by `take_exception` will
// always `impl cortex_m_interrupt::ExceptionHandle`.
let exc_handle = take_exception!(exception);
// For example:
let handle = cortex_m_interrupt::take_exception!(SysTick);