RfSetup

Struct RfSetup 

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

§RF_SETUP register

Set RF air data rate and output power.

Address = 0x06

§Fields

§cont_wave | bit 7

Enables continuous carrier transmit.

§rf_dr_low | bit 5

Set RF data rate to 250kbps. See rf_dr_high.

§pll_lock | bit 4

Force PLL lock signal. Only used in test.

§rf_dr_high | bit 3

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

§rf_pwr | bits 2:1

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

§Example

use nrf24l01_commands::{fields, registers};

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

// Write fields
let reg = registers::RfSetup::new()
    .with_pll_lock(false)
    .with_rf_dr_low(true)
    .with_rf_dr_high(fields::RfDrHigh::Mbps1)
    .with_rf_pwr(fields::RfPower::Neg6Dbm);
assert_eq!(reg.into_bits(), 0b0010_0100);

// Read fields
assert_eq!(reg.rf_pwr(), fields::RfPower::Neg6Dbm);

Implementations§

Source§

impl RfSetup

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

Enables continuous carrier transmit.

Bits: 7..8

Source

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

Enables continuous carrier transmit.

Bits: 7..8

Source

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

Enables continuous carrier transmit.

Bits: 7..8

Source

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

Enables continuous carrier transmit.

Bits: 7..8

Source

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

Enables continuous carrier transmit.

Bits: 7..8

Source

pub const fn rf_dr_low(&self) -> bool

Set RF data rate to 250kbps. See rf_dr_high.

Bits: 5..6

Source

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

Set RF data rate to 250kbps. See rf_dr_high.

Bits: 5..6

Source

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

Set RF data rate to 250kbps. See rf_dr_high.

Bits: 5..6

Source

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

Set RF data rate to 250kbps. See rf_dr_high.

Bits: 5..6

Source

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

Set RF data rate to 250kbps. See rf_dr_high.

Bits: 5..6

Source

pub const fn pll_lock(&self) -> bool

Force PLL lock signal. Only used in test.

Bits: 4..5

Source

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

Force PLL lock signal. Only used in test.

Bits: 4..5

Source

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

Force PLL lock signal. Only used in test.

Bits: 4..5

Source

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

Force PLL lock signal. Only used in test.

Bits: 4..5

Source

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

Force PLL lock signal. Only used in test.

Bits: 4..5

Source

pub const fn rf_dr_high(&self) -> RfDrHigh

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

Bits: 3..4

Source

pub const fn with_rf_dr_high_checked(self, value: RfDrHigh) -> Result<Self, ()>

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

Bits: 3..4

Source

pub const fn with_rf_dr_high(self, value: RfDrHigh) -> Self

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

Bits: 3..4

Source

pub const fn set_rf_dr_high(&mut self, value: RfDrHigh)

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

Bits: 3..4

Source

pub const fn set_rf_dr_high_checked( &mut self, value: RfDrHigh, ) -> Result<(), ()>

Select between the high speed data rates. This bit is don’t care if rf_dr_low is set. Enum: RfDrHigh. Default value: 1 (2 Mbps).

Encoding [RF_DR_LOW, RF_DR_HIGH]:

00 - 1Mbps

01 - 2Mbps

10 - 250kbps

11 - Reserved

Bits: 3..4

Source

pub const fn rf_pwr(&self) -> RfPower

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

Bits: 1..3

Source

pub const fn with_rf_pwr_checked(self, value: RfPower) -> Result<Self, ()>

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

Bits: 1..3

Source

pub const fn with_rf_pwr(self, value: RfPower) -> Self

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

Bits: 1..3

Source

pub const fn set_rf_pwr(&mut self, value: RfPower)

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

Bits: 1..3

Source

pub const fn set_rf_pwr_checked(&mut self, value: RfPower) -> Result<(), ()>

RF output power in TX mode. Enum: RfPower. Default value: 11 (0 dBm).

Bits: 1..3

Trait Implementations§

Source§

impl Clone for RfSetup

Source§

fn clone(&self) -> RfSetup

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 RfSetup

Source§

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

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

impl Default for RfSetup

Source§

fn default() -> Self

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

impl From<RfSetup> for u8

Source§

fn from(v: RfSetup) -> u8

Converts to this type from the input type.
Source§

impl From<u8> for RfSetup

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl Register for RfSetup

Source§

const ADDRESS: u8 = 6u8

Register address.
Source§

fn into_bits(self) -> u8

Convert register to bits.
Source§

impl Copy for RfSetup

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.