[−][src]Crate ruspiro_interrupt
Raspberry Pi Interrupt handler
This crates provides functions and macros (custom attribute) to conviniently implement interrupt handler for Raspberry Pi 3. The possible interrupts a handler can be implemented for are available as enum irqtypes::Interrupt
Usage
use ruspiro_interrupt::*; #[IrqHandler(ArmTimer)] fn timer_handler() { // TODO: acknowledge the irq // implement stuff that shall be executed if the interrupt is raised... // be careful when this code uses spinlocks as this might lead to dead-locks if the // executing code interrupted currently helds a lock the code inside this handler tries to aquire the same one println!("timer interrupt raised"); } fn demo() { // as we have an interrupt handler defined we need to enable interrupt handling globally as well // as the specific interrupt we have a handler implemented for IRQ_MANAGER.take_for(|irq_mgr| { irq_mgr.enable(); irq_mgr.activate(Interrupt.ArmTimer); }); }
Re-exports
pub use irqtypes::*; |
Modules
irqtypes | IRQ Types |
Structs
InterruptManager | The interrupt manager representation |
Statics
IRQ_MANAGER | The singleton accessor to the interrupt manager |