Status

Struct Status 

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

§STATUS register

Address = 0x07

§Fields

§rx_dr | bit 6

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

§tx_ds | bit 5

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

§max_rt | bit 4

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

§rx_p_no | bits 3:1

Data pipe number for the payload available from reading RX FIFO. This field is read-only. Enum: RxPipeNo.

§tx_full | bit 0

TX FIFO full flag. This field is read-only.

0: Not full

1: TX FIFO full

§Example

use nrf24l01_commands::{fields, registers};

// Default value
let reg = registers::Status::new();
assert_eq!(reg.into_bits(), 0);

// Read fields
let reg = registers::Status::from_bits(0b0011_0101);
assert!(!reg.rx_dr());
assert!(reg.tx_ds());
assert!(reg.max_rt());
assert_eq!(reg.rx_p_no(), fields::RxPipeNo::Pipe2);
assert!(reg.tx_full());

// Write fields
let reg = registers::Status::new()
    .with_rx_dr(false)
    .with_tx_ds(true)
    .with_max_rt(false);
assert_eq!(reg.into_bits(), 0b0010_0000);

Implementations§

Source§

impl Status

Source

pub const fn new() -> Self

Creates a new default initialized bitfield.

Source

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

Convert from bits.

Source

pub const fn into_bits(self) -> u8

Convert into bits.

Source

pub const fn rx_dr(&self) -> bool

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

Bits: 6..7

Source

pub const fn with_rx_dr_checked(self, value: bool) -> Result<Self, ()>

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

Bits: 6..7

Source

pub const fn with_rx_dr(self, value: bool) -> Self

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

Bits: 6..7

Source

pub const fn set_rx_dr(&mut self, value: bool)

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

Bits: 6..7

Source

pub const fn set_rx_dr_checked(&mut self, value: bool) -> Result<(), ()>

Data ready RX FIFO interrupt. Asserted when new data arrives in RX FIFO. Write 1 to clear bit.

Bits: 6..7

Source

pub const fn tx_ds(&self) -> bool

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

Bits: 5..6

Source

pub const fn with_tx_ds_checked(self, value: bool) -> Result<Self, ()>

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

Bits: 5..6

Source

pub const fn with_tx_ds(self, value: bool) -> Self

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

Bits: 5..6

Source

pub const fn set_tx_ds(&mut self, value: bool)

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

Bits: 5..6

Source

pub const fn set_tx_ds_checked(&mut self, value: bool) -> Result<(), ()>

Data sent TX FIFO interrupt. Asserted when packet is transmitted. If AUTO_ACK is activated, ACK must be received before interrupt goes high. Write 1 to clear bit.

Bits: 5..6

Source

pub const fn max_rt(&self) -> bool

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

Bits: 4..5

Source

pub const fn with_max_rt_checked(self, value: bool) -> Result<Self, ()>

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

Bits: 4..5

Source

pub const fn with_max_rt(self, value: bool) -> Self

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

Bits: 4..5

Source

pub const fn set_max_rt(&mut self, value: bool)

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

Bits: 4..5

Source

pub const fn set_max_rt_checked(&mut self, value: bool) -> Result<(), ()>

Maximum number of TX retransmits interrupt. If MAX_RT is asserted it must be cleared before communication can continue. Write 1 to clear bit.

Bits: 4..5

Source

pub const fn rx_p_no(&self) -> RxPipeNo

Data pipe number for the payload available from reading RX FIFO. This field is read-only. Enum: RxPipeNo.

Bits: 1..4

Source

pub const fn tx_full(&self) -> bool

TX FIFO full flag. This field is read-only.

0: Not full

1: TX FIFO full

Bits: 0..1

Trait Implementations§

Source§

impl Clone for Status

Source§

fn clone(&self) -> Status

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 Debug for Status

Source§

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

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

impl Default for Status

Source§

fn default() -> Self

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

impl From<Status> for u8

Source§

fn from(v: Status) -> u8

Converts to this type from the input type.
Source§

impl From<u8> for Status

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl Register for Status

Source§

const ADDRESS: u8 = 7u8

Register address.
Source§

fn into_bits(self) -> u8

Convert register to bits.
Source§

impl Copy for Status

Auto Trait Implementations§

§

impl Freeze for Status

§

impl RefUnwindSafe for Status

§

impl Send for Status

§

impl Sync for Status

§

impl Unpin for Status

§

impl UnwindSafe for Status

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.