Function esp_wifi::init

source ·
pub fn init<'d, T: EspWifiTimerSource>(
    timer: impl Peripheral<P = T> + 'd,
    _rng: impl EspWifiRngSource,
    _radio_clocks: impl Peripheral<P = RADIO_CLK> + 'd,
) -> Result<EspWifiController<'d>, InitializationError>
Expand description

Initialize for using WiFi and or BLE.

§The timer argument

The timer argument is a timer source that is used by the WiFi driver to schedule internal tasks. The timer source can be any of the following:

  • A timg Timer instance
  • A systimer Alarm instance
  • An AnyTimer instance
  • A OneShotTimer instance

§Examples

use esp_hal::{rng::Rng, timer::timg::TimerGroup};

let timg0 = TimerGroup::new(peripherals.TIMG0);
let init = esp_wifi::init(
    timg0.timer0,
    Rng::new(peripherals.RNG),
    peripherals.RADIO_CLK,
)
.unwrap();