[package]
name          = "esp-lp-hal"
version       = "0.3.0"
edition       = "2024"
rust-version  = "1.86.0"
description   = "HAL for low-power RISC-V coprocessors found in ESP32 devices"
documentation = "https://docs.espressif.com/projects/rust/esp-lp-hal/latest/"
keywords      = ["embedded", "embedded-hal", "esp32", "espressif", "hal"]
categories    = ["embedded", "hardware-support", "no-std"]
repository    = "https://github.com/esp-rs/esp-hal"
license       = "MIT OR Apache-2.0"

[package.metadata.docs.rs]
default-target = "riscv32imac-unknown-none-elf"
features       = ["esp32c6"]
rustdoc-args   = ["--cfg", "docsrs"]

[package.metadata.espressif]
targets_lp_core = true
doc-config = { features = ["embedded-hal"], append = [
    { features = ["embedded-io"], if = 'chip_has("lp_core")' },
] }
check-configs = [
    { features = [] },
    { features = ["embedded-hal"] },
    { features = ["embedded-io"] },
    { features = ["embedded-hal", "embedded-io"] },
]
clippy-configs = [
    { features = ["embedded-hal", "embedded-io"] },
]

[lib]
bench = false
test  = false

[dependencies]
cfg-if            = "1"
document-features = "0.2"
embedded-hal      = { version = "1.0.0",  optional = true }
embedded-hal-nb   = { version = "1.0.0",  optional = true }
embedded-io-06    = { package = "embedded-io", version = "0.6",  optional = true }
embedded-io-07    = { package = "embedded-io", version = "0.7",  optional = true }
esp32c6-lp        = { version = "0.3.0", features = ["critical-section"], optional = true }
esp32s2-ulp       = { version = "0.3.0", features = ["critical-section"], optional = true }
esp32s3-ulp       = { version = "0.3.0", features = ["critical-section"], optional = true }
nb                = { version = "1.1.0",  optional = true }
procmacros        = { version = "0.21.0", package = "esp-hal-procmacros", path = "../esp-hal-procmacros" }
riscv             = { version = "0.15", features = ["critical-section-single-hart"] }
esp-metadata-generated = { version = "0.3.0", path = "../esp-metadata-generated" }

[dev-dependencies]
panic-halt = "0.2.0"

[build-dependencies]
esp-metadata-generated = { version = "0.3.0", path = "../esp-metadata-generated", features = ["build-script"] }

[features]
default = ["embedded-hal"]

## Enable debug features in the HAL (used for development).
debug = [
    "esp32c6-lp?/impl-register-debug",
    "esp32s2-ulp?/impl-register-debug",
    "esp32s3-ulp?/impl-register-debug",
]

# Chip Support Feature Flags
# Target the ESP32-C6.
esp32c6 = ["dep:esp32c6-lp",  "esp-metadata-generated/esp32c6", "procmacros/is-lp-core", "dep:nb"]
# Target the ESP32-S2.
esp32s2 = ["dep:esp32s2-ulp", "esp-metadata-generated/esp32s2", "procmacros/is-ulp-core"]
# Target the ESP32-S3.
esp32s3 = ["dep:esp32s3-ulp", "esp-metadata-generated/esp32s3", "procmacros/is-ulp-core"]

#! ### Trait Implementation Feature Flags
## Implement the traits defined in the `1.0.0` releases of `embedded-hal` and
## `embedded-hal-nb` for the relevant peripherals.
embedded-hal = ["dep:embedded-hal", "dep:embedded-hal-nb"]
## Implement the traits defined in `embedded-io` for the relevant peripherals.
embedded-io = ["dep:embedded-io-06", "dep:embedded-io-07"]

[[example]]
name              = "blinky"
required-features = []

[[example]]
name              = "i2c"
required-features = ["esp32c6"]

[[example]]
name              = "uart"
required-features = ["esp32c6"]

[lints.rust]
unexpected_cfgs = "allow"
