[package]
name = "esp-wifi"
version = "0.11.0"
edition = "2021"
rust-version  = "1.83.0"
description = "A WiFi, Bluetooth and ESP-NOW driver for use with Espressif chips and bare-metal Rust"
documentation = "https://docs.esp-rs.org/esp-hal/"
keywords = ["wifi", "bluetooth", "esp-now", "esp32", "no-std"]
categories = ["embedded", "hardware-support", "no-std"]
repository = "https://github.com/esp-rs/esp-hal"
license = "MIT OR Apache-2.0"


[dependencies]
defmt = { version = "0.3.8", optional = true }
log = { version = "0.4.22", optional = true }
document-features  = "0.2.10"
esp-alloc = { version = "0.5.0", path = "../esp-alloc", optional = true }
esp-hal = { version = "0.22.0", path = "../esp-hal", default-features = false }
smoltcp = { version = "0.12.0", default-features = false, features = [
  "medium-ethernet",
  "socket-raw",
], optional = true }
critical-section = "1.2.0"
enumset = { version = "1.1.5", default-features = false, optional = true }
embedded-io = { version = "0.6.1", default-features = false }
embedded-io-async = { version = "0.6.1" }
fugit = "0.3.7"
heapless = { version = "0.8.0", default-features = false, features = [
  "portable-atomic",
] }
num-derive = { version = "0.4.2" }
num-traits = { version = "0.2.19", default-features = false }
esp-wifi-sys = "0.7.0"
embassy-sync = { version = "0.6.0", optional = true }
embassy-net-driver = { version = "0.2.0", optional = true }
libm = "0.2.11"
cfg-if = "1.0.0"
portable-atomic = { version = "1.9.0", default-features = false }
portable_atomic_enum = { version = "0.3.1", features = ["portable-atomic"] }
rand_core           = "0.6.4"

bt-hci = { version = "0.1.1", optional = true }
esp-config = { version = "0.2.0", path = "../esp-config" }

xtensa-lx-rt = { version = "0.17.2", path = "../xtensa-lx-rt", optional = true }
serde = { version = "1.0.215", default-features = false, features = ["derive"], optional = true }

[build-dependencies]
esp-build    = { version = "0.1.0", path = "../esp-build" }
esp-config   = { version = "0.2.0", path = "../esp-config", features = ["build"] }
esp-metadata = { version = "0.4.0", path = "../esp-metadata" }

[features]
default = ["esp-alloc"]

## Use `esp-alloc` for dynamic allocations.
##
## If you opt-out you need to provide implementations for `pub extern "C" fn esp_wifi_free_internal_heap() -> usize`
## and `pub extern "C" fn esp_wifi_allocate_from_internal_ram(size: usize) -> *mut u8`
esp-alloc = ["dep:esp-alloc"]

# Chip Support Feature Flags
# Target the ESP32-C2.
esp32c2 = [
  "esp-hal/esp32c2",
  "esp-wifi-sys/esp32c2",
]
# Target the ESP32-C3.
esp32c3 = [
  "esp-hal/esp32c3",
  "esp-wifi-sys/esp32c3",
]
# Target the ESP32-C6.
esp32c6 = [
  "esp-hal/esp32c6",
  "esp-wifi-sys/esp32c6",
]
# Target the ESP32-H2.
esp32h2 = [
  "esp-hal/esp32h2",
  "esp-wifi-sys/esp32h2",
]
# Target the ESP32.
esp32 = [
  "esp-hal/esp32",
  "esp-wifi-sys/esp32",
  "xtensa-lx-rt/float-save-restore",
]
# Target the ESP32-S2.
esp32s2 = [
  "esp-hal/esp32s2",
  "esp-wifi-sys/esp32s2",
  "xtensa-lx-rt/float-save-restore",
]
# Target the ESP32-S3.
esp32s3 = [
  "esp-hal/esp32s3",
  "esp-wifi-sys/esp32s3",
  "xtensa-lx-rt/float-save-restore",
]

## Enable WiFi-BLE coexistence support
coex = []

## Logs the WiFi logs from the driver at log level info (needs a nightly-compiler)
sys-logs = ["esp-wifi-sys/sys-logs"]

## Enable support for `defmt`
defmt = ["dep:defmt", "smoltcp?/defmt", "esp-hal/defmt", "bt-hci?/defmt", "esp-wifi-sys/defmt", "heapless/defmt-03"]

## Enable support for the `log` crate
log = ["dep:log", "esp-hal/log", "esp-wifi-sys/log"]

## Enable WiFi support
wifi = ["dep:enumset", "dep:embassy-net-driver", "dep:embassy-sync"]

## Enable esp-now support
esp-now = ["wifi"]

## Enable sniffer mode support
sniffer = ["wifi"]

## Enable BLE support
ble = ["esp-hal/bluetooth", "dep:bt-hci", "dep:embassy-sync"]

## Provide implementations of smoltcp traits
smoltcp = ["dep:smoltcp"]

## Provide utilities for smoltcp initialization. Adds smoltcp dependency
utils = ["smoltcp"]


# Implement serde Serialize / Deserialize
serde = ["dep:serde", "enumset?/serde", "heapless/serde"]

[package.metadata.docs.rs]
features = [
  "esp32c3",
  "wifi",
  "ble",
  "coex",
  "esp-hal/default",
]
default-target = "riscv32imc-unknown-none-elf"
