Struct ConfigBuilder

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

A builder for an Config structure

The builder is converted into an Config by calling the check() method.

§Example

use esb::ConfigBuilder;

let config_result = ConfigBuilder::default()
    .wait_for_ack_timeout(50)
    .retransmit_delay(240)
    .maximum_transmit_attempts(4)
    .enabled_pipes(0x01)
    .check();

assert!(config_result.is_ok());

§Default Config Contents

By default, the following settings will be used:

FieldDefault Value
Ack Timeout120 us
Retransmit Delay500 us
Maximum number of transmit attempts3
Enabled Pipes0xFF
Tx Power0dBm
Maximum payload size252 bytes

Implementations§

Source§

impl ConfigBuilder

Source

pub fn wait_for_ack_timeout(self, micros: u16) -> Self

Sets number of microseconds to wait for an acknowledgement before timing out

Source

pub fn retransmit_delay(self, micros: u16) -> Self

Sets retransmit delay, must be bigger than wait_for_ack_timeout field plus 62 and bigger than the ramp-up time (140us without fast-ru and 40us with fast-ru)

Source

pub fn maximum_transmit_attempts(self, n: u8) -> Self

Sets maximum number of transmit attempts

Source

pub fn enabled_pipes(self, enabled_pipes: u8) -> Self

Sets enabled pipes for receiving

Source

pub fn tx_power(self, tx_power: TxPower) -> Self

Sets the tx power

Source

pub fn max_payload_size(self, payload_size: u8) -> Self

Sets the maximum payload size

Source

pub fn check(self) -> Result<Config, Error>

Trait Implementations§

Source§

impl Default for ConfigBuilder

Source§

fn default() -> ConfigBuilder

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

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> 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.