Macro interrupt::register_interrupt
source · [−]macro_rules! register_interrupt {
($get:path, $set:path) => { ... };
}
This is supported on crate feature
custom
only.Expand description
Register interrupt function on custom targets.
Usage
To register the function, we first depend on interrupt
in Cargo.toml
:
[dependencies]
interrupt = { version = "0.1", features = ["custom"] }
Then, we register the function in src/main.rs
:
fn interrupt_get_mask() -> u32 {
register.read()
}
fn interrupt_set_mask(mask: u32) {
register.write(mask)
}
register_interrupt!(interrupt_get_mask, interrupt_set_mask);
Addition
You can also register fn rust_interrupt_get() -> u32;
and fn rust_interrupt_set(mask: u32);
in the Static-link Library or Dynamic-link Library.