pub struct IrqSelection(/* private fields */);
Expand description
Represents a selection of 0 or more IRQs.
Internally the FPGA API expects a bitwise field to select IRQs. This type wraps that representation with functions to help make different selections and conversions.
For single IRQs you can use IrqSelection::new
and to query if they are set use IrqSelection::is_irq_set
.
use ni_fpga_interface::irq::IrqSelection;
let selection = IrqSelection::new(2);
assert_eq!(selection.is_irq_set(2), true);
There is also an iterator method if you want to cycle through the set IRQs.
use ni_fpga_interface::irq::IrqSelection;
let mut selection = IrqSelection::new(0);
selection.add_irq(2);
for irq in selection.iter() {
println!("IRQ: {}", irq);
}
To mimic the C API the IRQs are also available as constants.
use ni_fpga_interface::irq::{IRQ1};
assert_eq!(IRQ1.is_irq_set(1), true);
Implementations§
Source§impl IrqSelection
impl IrqSelection
Sourcepub const NONE: IrqSelection
pub const NONE: IrqSelection
Represents a selection with no IRQs.
Sourcepub const fn new(irq: u8) -> IrqSelection
pub const fn new(irq: u8) -> IrqSelection
Creates a new IRQ selection with the specified IRQ included.
Sourcepub fn is_irq_set(&self, irq: u8) -> bool
pub fn is_irq_set(&self, irq: u8) -> bool
Check if an IRQ number is set.
Trait Implementations§
Source§impl Clone for IrqSelection
impl Clone for IrqSelection
Source§fn clone(&self) -> IrqSelection
fn clone(&self) -> IrqSelection
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for IrqSelection
impl Debug for IrqSelection
Source§impl Default for IrqSelection
impl Default for IrqSelection
Source§impl From<u32> for IrqSelection
impl From<u32> for IrqSelection
Source§impl PartialEq for IrqSelection
impl PartialEq for IrqSelection
impl Copy for IrqSelection
impl Eq for IrqSelection
impl StructuralPartialEq for IrqSelection
Auto Trait Implementations§
impl Freeze for IrqSelection
impl RefUnwindSafe for IrqSelection
impl Send for IrqSelection
impl Sync for IrqSelection
impl Unpin for IrqSelection
impl UnwindSafe for IrqSelection
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