Struct Interrupts

Source
pub struct Interrupts(/* private fields */);
Expand description

A bitfield representing multiple nRF24L01 interrupts.

This structure allows for the manipulation and checking of interrupt flags as they appear in the STATUS register. Multiple interrupts can be combined using the builder pattern methods.

§Examples

// Create an interrupt set with RX data ready and max retries
let interrupts = Interrupts::new().rx_data_ready().max_retries();

// Check if a specific interrupt is set
if interrupts.contains(InterruptKind::RxDataReady) {
    // Handle RX data ready interrupt
}

Implementations§

Source§

impl Interrupts

Source

pub fn new() -> Self

Creates a new empty interrupt set with no interrupts enabled.

Source

pub fn all() -> Self

Creates an interrupt set with all possible interrupts enabled.

Source

pub fn max_retries(self) -> Self

Adds the Maximum Retries interrupt to this set.

This interrupt is triggered when the maximum number of retransmits has been reached on a packet.

Source

pub fn tx_data_sent(self) -> Self

Adds the TX Data Sent interrupt to this set.

This interrupt is triggered when a packet has been successfully transmitted.

Source

pub fn rx_data_ready(self) -> Self

Adds the RX Data Ready interrupt to this set.

This interrupt is triggered when new data has arrived in the RX FIFO.

Source

pub fn contains(&self, irq: InterruptKind) -> bool

Checks if the given interrupt kind is set in this interrupt set.

Returns true if the interrupt is set, false otherwise.

Trait Implementations§

Source§

impl Clone for Interrupts

Source§

fn clone(&self) -> Interrupts

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl From<u8> for Interrupts

Source§

fn from(t: u8) -> Self

Converts a raw byte value to an Interrupts struct.

Only bits that correspond to valid interrupts are preserved.

Source§

impl Copy for Interrupts

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.