Skip to main content

IrqFlags

Struct IrqFlags 

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

A set of SX127x LoRa interrupts, in the layout of RegIrqFlags.

§Examples

use pamoja_radios::sx127x::irq::IrqFlags;

// RegIrqFlags read 0x70: a packet arrived with a valid header but a bad payload CRC.
let raised = IrqFlags::from_bits(0x70);
assert!(raised.contains(IrqFlags::RX_DONE | IrqFlags::PAYLOAD_CRC_ERROR));
assert!(!raised.contains(IrqFlags::TX_DONE));

Implementations§

Source§

impl IrqFlags

Source

pub const NONE: IrqFlags

No interrupt.

Source

pub const CAD_DETECTED: IrqFlags

Bit 0: channel activity detection heard a LoRa signal.

Source

pub const FHSS_CHANGE_CHANNEL: IrqFlags

Bit 1: frequency hopping moved to the next channel.

Source

pub const CAD_DONE: IrqFlags

Bit 2: channel activity detection finished.

Source

pub const TX_DONE: IrqFlags

Bit 3: the payload in the data buffer has been transmitted.

Source

pub const VALID_HEADER: IrqFlags

Bit 4: a valid header was received.

Source

pub const PAYLOAD_CRC_ERROR: IrqFlags

Bit 5: the payload failed its CRC.

Source

pub const RX_DONE: IrqFlags

Bit 6: a packet has been received.

Source

pub const RX_TIMEOUT: IrqFlags

Bit 7: a single reception timed out before a preamble arrived.

Source

pub const ALL: IrqFlags

Every interrupt, which is what writing 0xFF clears.

Source

pub const fn from_bits(bits: u8) -> IrqFlags

Creates a set from the register’s bits.

§Arguments
  • bits - the RegIrqFlags value.
§Returns

The set.

Source

pub const fn bits(self) -> u8

Returns the register’s bits.

§Returns

The RegIrqFlags value, which written back clears exactly these interrupts.

Source

pub const fn contains(self, other: IrqFlags) -> bool

Reports whether every interrupt of another set is in this one.

§Arguments
  • other - the interrupts to look for.
§Returns

true when all of them are set.

Source

pub const fn intersects(self, other: IrqFlags) -> bool

Reports whether any interrupt of another set is in this one.

§Arguments
  • other - the interrupts to look for.
§Returns

true when at least one of them is set.

Source

pub const fn is_empty(self) -> bool

Reports whether the set holds no interrupt.

§Returns

true when no bit is set.

Trait Implementations§

Source§

impl BitAnd for IrqFlags

Source§

type Output = IrqFlags

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: IrqFlags) -> IrqFlags

Performs the & operation. Read more
Source§

impl BitOr for IrqFlags

Source§

type Output = IrqFlags

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: IrqFlags) -> IrqFlags

Performs the | operation. Read more
Source§

impl BitOrAssign for IrqFlags

Source§

fn bitor_assign(&mut self, rhs: IrqFlags)

Performs the |= operation. Read more
Source§

impl Clone for IrqFlags

Source§

fn clone(&self) -> IrqFlags

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for IrqFlags

Source§

impl Debug for IrqFlags

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IrqFlags

Source§

fn default() -> IrqFlags

Returns the “default value” for a type. Read more
Source§

impl Eq for IrqFlags

Source§

impl Hash for IrqFlags

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for IrqFlags

Source§

fn eq(&self, other: &IrqFlags) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for IrqFlags

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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.