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:
| Field | Default Value |
|---|---|
| Ack Timeout | 120 us |
| Retransmit Delay | 500 us |
| Maximum number of transmit attempts | 3 |
| Enabled Pipes | 0xFF |
| Tx Power | 0dBm |
| Maximum payload size | 252 bytes |
Implementations§
Source§impl ConfigBuilder
impl ConfigBuilder
Sourcepub fn wait_for_ack_timeout(self, micros: u16) -> Self
pub fn wait_for_ack_timeout(self, micros: u16) -> Self
Sets number of microseconds to wait for an acknowledgement before timing out
Sourcepub fn retransmit_delay(self, micros: u16) -> Self
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)
Sourcepub fn maximum_transmit_attempts(self, n: u8) -> Self
pub fn maximum_transmit_attempts(self, n: u8) -> Self
Sets maximum number of transmit attempts
Sourcepub fn enabled_pipes(self, enabled_pipes: u8) -> Self
pub fn enabled_pipes(self, enabled_pipes: u8) -> Self
Sets enabled pipes for receiving
Sourcepub fn max_payload_size(self, payload_size: u8) -> Self
pub fn max_payload_size(self, payload_size: u8) -> Self
Sets the maximum payload size
pub fn check(self) -> Result<Config, Error>
Trait Implementations§
Source§impl Default for ConfigBuilder
impl Default for ConfigBuilder
Source§fn default() -> ConfigBuilder
fn default() -> ConfigBuilder
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ConfigBuilder
impl RefUnwindSafe for ConfigBuilder
impl Send for ConfigBuilder
impl Sync for ConfigBuilder
impl Unpin for ConfigBuilder
impl UnwindSafe for ConfigBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more