Struct maia_httpd::fpga::InterruptHandler
source · pub struct InterruptHandler { /* private fields */ }
Expand description
Interrupt handler.
Receives the interrupts produced by the FPGA IP core and sends notifications
to the InterruptWaiter
s. It is necessary to call
InterruptHandler::run
in order to receive and process interrupts.
§Examples
This shows how to create an InterruptHandler
, obtain an InterruptWaiter
,
and wait for an interrupt, while running the InterruptHandler
concurrently
in a Tokio task.
use maia_httpd::fpga::IpCore;
let (ip_core, interrupt_handler) = IpCore::take().await?;
let waiter = interrupt_handler.waiter_recorder();
tokio::spawn(async move { interrupt_handler.run() });
waiter.wait().await;
Implementations§
source§impl InterruptHandler
impl InterruptHandler
sourcepub async fn run(self) -> Result<()>
pub async fn run(self) -> Result<()>
Runs the interrupt handler.
This function only returns if there is an error.
The function must be run concurrently with the rest of the application so that interrupts can be received and notifications can be sent to the waiters.
sourcepub fn waiter_spectrometer(&self) -> InterruptWaiter
pub fn waiter_spectrometer(&self) -> InterruptWaiter
Returns a waiter for the spectrometer interrupt.
sourcepub fn waiter_recorder(&self) -> InterruptWaiter
pub fn waiter_recorder(&self) -> InterruptWaiter
Returns a waiter for the recorder interrupt.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for InterruptHandler
impl Send for InterruptHandler
impl !Sync for InterruptHandler
impl Unpin for InterruptHandler
impl !UnwindSafe for InterruptHandler
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more