Macro stm32f103xx::exception []

macro_rules! exception {
    (
$ NAME : ident , $ path : path , locals : {
$ ( $ lvar : ident : $ lty : ident = $ lval : expr ; ) + } ) => { ... };
    (
$ NAME : ident , $ path : path ) => { ... };
}

Assigns a handler to an exception

This macro takes two arguments: the name of an exception and the path to the function that will be used as the handler of that exception. That function must have signature fn().

Optionally, a third argument may be used to declare exception local data. The handler will have exclusive access to these local variables on each invocation. If the third argument is used then the signature of the handler function must be fn(&mut $NAME::Locals) where $NAME is the first argument passed to the macro.

Example

This example is not tested
exception!(MEM_MANAGE, mpu_fault);

fn mpu_fault() {
    panic!("Oh no! Something went wrong");
}

exception!(SYS_TICK, periodic, locals: {
    counter: u32 = 0;
});

fn periodic(locals: &mut SYS_TICK::Locals) {
    locals.counter += 1;
    println!("This function has been called {} times", locals.counter);
}