Skip to content

Commit

Permalink
Add a default-config constructor for AP-STA
Browse files Browse the repository at this point in the history
  • Loading branch information
bugadani committed Oct 26, 2023
1 parent 5c76bd6 commit c36e963
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions esp-wifi/src/wifi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,6 @@ pub fn new_with_config<'d>(
_ => {}
}

// TODO: we'll need two devices for AP-STA mode
let mode = WifiMode::try_from(&config)?;

Ok((
Expand Down Expand Up @@ -871,12 +870,24 @@ pub fn new_with_mode<'d>(
)
}

/// Creates a new Wifi device and controller in AP-STA mode.
/// Creates a new Wifi device and controller in AP-STA mode, with a default configuration.
///
/// Returns a tuple of `(AP device, STA device, controller)`.
pub fn new_ap_sta<'d>(
inited: &EspWifiInitialization,
device: impl Peripheral<P = crate::hal::radio::Wifi> + 'd,
) -> Result<(WifiDevice<'d>, WifiDevice<'d>, WifiController<'d>), WifiError> {
crate::hal::into_ref!(device);

new_ap_sta_with_config(inited, device, Default::default(), Default::default())
}

/// Creates a new Wifi device and controller in AP-STA mode.
///
/// Returns a tuple of `(AP device, STA device, controller)`.
pub fn new_ap_sta_with_config<'d>(
inited: &EspWifiInitialization,
device: impl Peripheral<P = crate::hal::radio::Wifi> + 'd,
sta_config: embedded_svc::wifi::ClientConfiguration,
ap_config: embedded_svc::wifi::AccessPointConfiguration,
) -> Result<(WifiDevice<'d>, WifiDevice<'d>, WifiController<'d>), WifiError> {
Expand Down

0 comments on commit c36e963

Please sign in to comment.