Struct nrf24_rs::config::NrfConfig[][src]

pub struct NrfConfig { /* fields omitted */ }
Expand description

Configuration builder struct for NRF chip.

Always created with the default() method and modified through the builder pattern.

Example: default

use nrf24::Nrf24l01;
use nrf24::config::NrfConfig;

let config = NrfConfig::default();

let mut chip = Nrf24l01::new(spi, ce, ncs, delay, config)?;

Example: custom configuration

use nrf24::Nrf24l01;
use nrf24::config::{PALevel, DataRate, NrfConfig, PayloadSize};

let config = NrfConfig::default()
    .payload_size(PayloadSize::Dynamic) // set dynamic payload size
    .channel(7)
    .addr_width(3),
    .data_rate(DataRate::R2Mbps)
    .pa_level(PALevel::Max)
    .crc_encoding_scheme(None) // disable crc
    .ack_payloads_enabled(true)
    .auto_retry((15, 15));

let mut chip = Nrf24l01::new(spi, ce, ncs, delay, config)?;

Implementations

impl NrfConfig[src]

pub fn payload_size<T: Into<PayloadSize>>(self, payload_size: T) -> Self[src]

Set Payload Size A value of 0 means dynamic payloads will be enabled. Values greater than MAX_PAYLOAD_SIZE will be floored.

pub fn channel(self, channel: u8) -> Self[src]

Set RF channel Must be a number in [0..125], values outside will be clipped

pub fn addr_width<T: Into<AddressWidth>>(self, addr_width: T) -> Self[src]

Set the Address Width If using a number, it must be in [3..5], values outside will be clipped

pub fn data_rate(self, data_rate: DataRate) -> Self[src]

Set the Data Rate

pub fn pa_level(self, pa_level: PALevel) -> Self[src]

Set the Power Amplification Level

pub fn crc_encoding_scheme(
    self,
    crc_encoding_scheme: Option<EncodingScheme>
) -> Self
[src]

Set the Cyclic Redundancy Check Encodign Scheme None will disable the CRC.

pub fn ack_payloads_enabled(self, ack_payloads_enabled: bool) -> Self[src]

Configure if auto acknowledgements are enabled

pub fn auto_retry<T: Into<AutoRetransmission>>(self, auto_retry: T) -> Self[src]

Set the automatic retransmission config

Trait Implementations

impl Clone for NrfConfig[src]

fn clone(&self) -> NrfConfig[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for NrfConfig[src]

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

Formats the value using the given formatter. Read more

impl Default for NrfConfig[src]

fn default() -> Self[src]

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

impl Copy for NrfConfig[src]

Auto Trait Implementations

impl Send for NrfConfig

impl Sync for NrfConfig

impl Unpin for NrfConfig

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.