nrf24l01_commands::registers

Struct Feature

source
pub struct Feature(/* private fields */);
Expand description

§FEATURE register

Enable features ‘Dynamic Payload Length’, ‘Payload with ACK’ and ‘W_TX_PAYLOAD_NO_ACK’ command. To activate this register, use the ACTIVATE command. To deactivate this register, use the ACTIVATE command again.

Address = 0x01D

§Fields

§en_dpl | bit 2

Enables Dynamic Payload Length.

§en_ack_pay | bit 1

Enables Payload with ACK.

§en_dyn_ack | bit 0

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

§Example

use nrf24l01_commands::registers;

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

// Write fields
let reg = registers::Feature::new()
    .with_en_dpl(false)
    .with_en_ack_pay(true)
    .with_en_dyn_ack(true);
assert_eq!(reg.into_bits(), 0b0000_0011);

Implementations§

source§

impl Feature

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

Enables Dynamic Payload Length.

Bits: 2..3

source

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

Enables Dynamic Payload Length.

Bits: 2..3

source

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

Enables Dynamic Payload Length.

Bits: 2..3

source

pub fn set_en_dpl(&mut self, value: bool)

Enables Dynamic Payload Length.

Bits: 2..3

source

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

Enables Dynamic Payload Length.

Bits: 2..3

source

pub const fn en_ack_pay(&self) -> bool

Enables Payload with ACK.

Bits: 1..2

source

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

Enables Payload with ACK.

Bits: 1..2

source

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

Enables Payload with ACK.

Bits: 1..2

source

pub fn set_en_ack_pay(&mut self, value: bool)

Enables Payload with ACK.

Bits: 1..2

source

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

Enables Payload with ACK.

Bits: 1..2

source

pub const fn en_dyn_ack(&self) -> bool

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

Bits: 0..1

source

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

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

Bits: 0..1

source

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

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

Bits: 0..1

source

pub fn set_en_dyn_ack(&mut self, value: bool)

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

Bits: 0..1

source

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

Enables ‘W_TX_PAYLOAD_NO_ACK’ command.

Bits: 0..1

Trait Implementations§

source§

impl Clone for Feature

source§

fn clone(&self) -> Feature

Returns a copy 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 Feature

source§

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

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

impl Default for Feature

source§

fn default() -> Self

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

impl From<Feature> for u8

source§

fn from(v: Feature) -> u8

Converts to this type from the input type.
source§

impl From<u8> for Feature

source§

fn from(v: u8) -> Self

Converts to this type from the input type.
source§

impl Register for Feature

source§

const ADDRESS: u8 = 29u8

Register address.
source§

impl Copy for Feature

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.