Function init

Source
pub fn init<'d>(
    timer: impl EspWifiTimerSource + 'd,
    _rng: impl EspWifiRngSource + 'd,
    _radio_clocks: RADIO_CLK<'d>,
) -> Result<EspWifiController<'d>, InitializationError>
Expand description

Initialize for using WiFi and or BLE.

Make sure to not call this function while interrupts are disabled.

§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

§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();