Config

Struct Config 

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

§CONFIG register

Address = 0x00

§Fields

§mask_rx_dr | bit 6

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

§mask_tx_ds | bit 5

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

§mask_max_rt | bit 4

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

§en_crc | bit 3

Enable/disable CRC. Default value: 1 (enabled)

§crco | bit 2

CRC encoding scheme. Enum: Crco.

§pwr_up | bit 1

Power down/up.

0: Power down

1: Power up

§prim_rx | bit 0

Set primary TX/RX.

0: primary TX

1: primary RX

§Example

use nrf24l01_commands::{fields, registers};

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

// Write fields
let reg = registers::Config::new()
    .with_mask_rx_dr(true)
    .with_mask_tx_ds(false)
    .with_mask_max_rt(false)
    .with_en_crc(false)
    .with_crco(fields::Crco::TwoByte)
    .with_pwr_up(true)
    .with_prim_rx(false);
assert_eq!(reg.into_bits(), 0b0100_0110);

Implementations§

Source§

impl Config

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 mask_rx_dr(&self) -> bool

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 6..7

Source

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

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 6..7

Source

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

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 6..7

Source

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

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 6..7

Source

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

Mask/unmask interrupt caused by RX_DR.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 6..7

Source

pub const fn mask_tx_ds(&self) -> bool

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 5..6

Source

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

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 5..6

Source

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

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 5..6

Source

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

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 5..6

Source

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

Mask/unmask interrupt caused by TX_DS.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 5..6

Source

pub const fn mask_max_rt(&self) -> bool

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 4..5

Source

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

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 4..5

Source

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

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 4..5

Source

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

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 4..5

Source

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

Mask/unmask interrupt caused by MAX_RT.

0: unmasked, interrupt reflected on IRQ

1: masked, interrupt not reflected on IRQ

Bits: 4..5

Source

pub const fn en_crc(&self) -> bool

Enable/disable CRC. Default value: 1 (enabled)

Bits: 3..4

Source

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

Enable/disable CRC. Default value: 1 (enabled)

Bits: 3..4

Source

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

Enable/disable CRC. Default value: 1 (enabled)

Bits: 3..4

Source

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

Enable/disable CRC. Default value: 1 (enabled)

Bits: 3..4

Source

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

Enable/disable CRC. Default value: 1 (enabled)

Bits: 3..4

Source

pub const fn crco(&self) -> Crco

CRC encoding scheme. Enum: Crco.

Bits: 2..3

Source

pub const fn with_crco_checked(self, value: Crco) -> Result<Self, ()>

CRC encoding scheme. Enum: Crco.

Bits: 2..3

Source

pub const fn with_crco(self, value: Crco) -> Self

CRC encoding scheme. Enum: Crco.

Bits: 2..3

Source

pub const fn set_crco(&mut self, value: Crco)

CRC encoding scheme. Enum: Crco.

Bits: 2..3

Source

pub const fn set_crco_checked(&mut self, value: Crco) -> Result<(), ()>

CRC encoding scheme. Enum: Crco.

Bits: 2..3

Source

pub const fn pwr_up(&self) -> bool

Power down/up.

0: Power down

1: Power up

Bits: 1..2

Source

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

Power down/up.

0: Power down

1: Power up

Bits: 1..2

Source

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

Power down/up.

0: Power down

1: Power up

Bits: 1..2

Source

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

Power down/up.

0: Power down

1: Power up

Bits: 1..2

Source

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

Power down/up.

0: Power down

1: Power up

Bits: 1..2

Source

pub const fn prim_rx(&self) -> bool

Set primary TX/RX.

0: primary TX

1: primary RX

Bits: 0..1

Source

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

Set primary TX/RX.

0: primary TX

1: primary RX

Bits: 0..1

Source

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

Set primary TX/RX.

0: primary TX

1: primary RX

Bits: 0..1

Source

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

Set primary TX/RX.

0: primary TX

1: primary RX

Bits: 0..1

Source

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

Set primary TX/RX.

0: primary TX

1: primary RX

Bits: 0..1

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

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 Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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

impl From<Config> for u8

Source§

fn from(v: Config) -> u8

Converts to this type from the input type.
Source§

impl From<u8> for Config

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl Register for Config

Source§

const ADDRESS: u8 = 0u8

Register address.
Source§

fn into_bits(self) -> u8

Convert register to bits.
Source§

impl Copy for Config

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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.