Struct Config

Source
pub struct Config { /* private fields */ }
Expand description

Wi-Fi configuration.

Implementations§

Source§

impl Config

Source

pub fn with_power_save_mode(self, power_save_mode: PowerSaveMode) -> Self

Assign the given value to the power_save_mode field.

Source

pub fn power_save_mode(&self) -> PowerSaveMode

Power save mode.

Source

pub fn with_country_code(self, country_code: impl Into<CountryInfo>) -> Self

Available on crate feature unstable only.

Assign the given value to the country_code field.

Source

pub fn country_code(&self) -> CountryInfo

Available on crate feature unstable only.

Country code.

Source

pub fn with_rx_queue_size(self, rx_queue_size: usize) -> Self

Available on crate feature unstable only.

Assign the given value to the rx_queue_size field.

Source

pub fn rx_queue_size(&self) -> usize

Available on crate feature unstable only.

Size of the RX queue in frames.

Source

pub fn with_tx_queue_size(self, tx_queue_size: usize) -> Self

Available on crate feature unstable only.

Assign the given value to the tx_queue_size field.

Source

pub fn tx_queue_size(&self) -> usize

Available on crate feature unstable only.

Size of the TX queue in frames.

Source

pub fn with_static_rx_buf_num(self, static_rx_buf_num: u8) -> Self

Available on crate feature unstable only.

Assign the given value to the static_rx_buf_num field.

Source

pub fn static_rx_buf_num(&self) -> u8

Available on crate feature unstable only.

Max number of WiFi static RX buffers.

Each buffer takes approximately 1.6KB of RAM. The static rx buffers are allocated when esp_wifi_init is called, they are not freed until esp_wifi_deinit is called.

WiFi hardware use these buffers to receive all 802.11 frames. A higher number may allow higher throughput but increases memory use. If Self::ampdu_rx_enable is enabled, this value is recommended to set equal or bigger than Self::rx_ba_win in order to achieve better throughput and compatibility with both stations and APs.

Source

pub fn with_dynamic_rx_buf_num(self, dynamic_rx_buf_num: u16) -> Self

Available on crate feature unstable only.

Assign the given value to the dynamic_rx_buf_num field.

Source

pub fn dynamic_rx_buf_num(&self) -> u16

Available on crate feature unstable only.

Max number of WiFi dynamic RX buffers

Set the number of WiFi dynamic RX buffers, 0 means unlimited RX buffers will be allocated (provided sufficient free RAM). The size of each dynamic RX buffer depends on the size of the received data frame.

For each received data frame, the WiFi driver makes a copy to an RX buffer and then delivers it to the high layer TCP/IP stack. The dynamic RX buffer is freed after the higher layer has successfully received the data frame.

For some applications, WiFi data frames may be received faster than the application can process them. In these cases we may run out of memory if RX buffer number is unlimited (0).

If a dynamic RX buffer limit is set, it should be at least the number of static RX buffers.

Source

pub fn with_static_tx_buf_num(self, static_tx_buf_num: u8) -> Self

Available on crate feature unstable only.

Assign the given value to the static_tx_buf_num field.

Source

pub fn static_tx_buf_num(&self) -> u8

Available on crate feature unstable only.

Set the number of WiFi static TX buffers.

Each buffer takes approximately 1.6KB of RAM. The static RX buffers are allocated when esp_wifi_init() is called, they are not released until esp_wifi_deinit() is called.

For each transmitted data frame from the higher layer TCP/IP stack, the WiFi driver makes a copy of it in a TX buffer.

For some applications especially UDP applications, the upper layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX buffers.

Source

pub fn with_dynamic_tx_buf_num(self, dynamic_tx_buf_num: u16) -> Self

Available on crate feature unstable only.

Assign the given value to the dynamic_tx_buf_num field.

Source

pub fn dynamic_tx_buf_num(&self) -> u16

Available on crate feature unstable only.

Set the number of WiFi dynamic TX buffers.

The size of each dynamic TX buffer is not fixed, it depends on the size of each transmitted data frame.

For each transmitted frame from the higher layer TCP/IP stack, the WiFi driver makes a copy of it in a TX buffer.

For some applications, especially UDP applications, the upper layer can deliver frames faster than WiFi layer can transmit. In these cases, we may run out of TX buffers.

Source

pub fn with_ampdu_rx_enable(self, ampdu_rx_enable: bool) -> Self

Available on crate feature unstable only.

Assign the given value to the ampdu_rx_enable field.

Source

pub fn ampdu_rx_enable(&self) -> bool

Available on crate feature unstable only.

Select this option to enable AMPDU RX feature.

Source

pub fn with_ampdu_tx_enable(self, ampdu_tx_enable: bool) -> Self

Available on crate feature unstable only.

Assign the given value to the ampdu_tx_enable field.

Source

pub fn ampdu_tx_enable(&self) -> bool

Available on crate feature unstable only.

Select this option to enable AMPDU TX feature.

Source

pub fn with_amsdu_tx_enable(self, amsdu_tx_enable: bool) -> Self

Available on crate feature unstable only.

Assign the given value to the amsdu_tx_enable field.

Source

pub fn amsdu_tx_enable(&self) -> bool

Available on crate feature unstable only.

Select this option to enable AMSDU TX feature.

Source

pub fn with_rx_ba_win(self, rx_ba_win: u8) -> Self

Available on crate feature unstable only.

Assign the given value to the rx_ba_win field.

Source

pub fn rx_ba_win(&self) -> u8

Available on crate feature unstable only.

Set the size of WiFi Block Ack RX window.

Generally a bigger value means higher throughput and better compatibility but more memory. Most of time we should NOT change the default value unless special reason, e.g. test the maximum UDP RX throughput with iperf etc. For iperf test in shieldbox, the recommended value is 9~12.

If PSRAM is used and WiFi memory is preferred to allocate in PSRAM first, the default and minimum value should be 16 to achieve better throughput and compatibility with both stations and APs.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Config

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Config

Source§

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

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

impl Default for Config

Source§

fn default() -> Self

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

impl Format for Config

Source§

fn format(&self, f: Formatter<'_>)

Writes the defmt representation of self to fmt.
Source§

impl Copy for Config

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

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> Same for T

Source§

type Output = T

Should always be Self
§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

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

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
§

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

Performs the conversion.