m5stack-core 0.3.1

Board support crate for M5Stack Fire27 and CoreS3 (ESP32/ESP32-S3)
[package]
name = "m5stack-core"
version = "0.3.1"
edition = "2024"
rust-version = "1.86"
license = "MIT OR Apache-2.0"
description = "Board support crate for M5Stack Fire27 and CoreS3 (ESP32/ESP32-S3)"
repository = "https://github.com/emobotics-dev/m5stack-core"
readme = "README.md"
keywords = ["esp32", "m5stack", "embedded", "bsp", "embassy"]
categories = ["embedded", "no-std", "hardware-support"]

[lib]
test = false
bench = false

[features]
fire27 = ["esp-hal/esp32", "esp-radio/esp32", "esp-sync/esp32"]
cores3 = ["esp-hal/esp32s3", "esp-radio/esp32s3", "esp-sync/esp32s3"]
# Enables the masked 1-Wire ROM search (driver::onewire::Search::new_with_mask),
# constraining enumeration to addresses matching fixed bits under a mask.
search-masks = []
# HIL serial-cmd driver — exposes a Read endpoint over UART0 (fire27) or
# USB-Serial-JTAG (cores3). Paired with `alternator-regulator/serial-cmd`.
serial-cmd = []
# External PSRAM heap support (the `mem` module). Enabling it activates a
# build-time guard requiring opt-level > 0 (build.rs) and the compile-time
# `PsramSafe` atomic check (uses the `esp` nightly auto-trait features).
psram = ["dep:esp-alloc", "dep:allocator-api2"]

# --- Radio (driver::radio) — orthogonal to the chip features; combine per app.
# The radio is shared, so `coex` is required to run BLE and WiFi at once.
ble      = ["esp-radio/ble"]                                  # driver::radio::ble (BleRadio → BleConnector)
wifi     = ["esp-radio/wifi"]                                 # driver::radio::wifi (controller + scan)
wifi-sta = ["wifi", "dep:embassy-net"] # STA + DHCP embassy_net::Stack
wifi-ap  = ["wifi", "dep:embassy-net"] # reserved for AP mode (not yet implemented)
coex     = ["esp-radio/coex", "wifi", "ble"]                  # software WiFi/BLE coexistence (extra RAM)

[dependencies]
# esp-hal family — stock crates.io versions so the crate publishes. The whole
# family is version-locked together, so they are pinned exactly; local and
# example builds are redirected to the emobotics fork (a coherent snapshot of
# the same versions, plus SPI/DMA patches the examples need) via the rev-pinned
# [patch.crates-io] below, which `cargo publish` ignores.
esp-alloc           = { version = "=0.10.0", optional = true }
esp-hal             = { version = "=1.1.1", features = ["unstable"] }
esp-radio           = { version = "=0.18.0", features = ["esp-alloc", "unstable"] }
esp-sync            = { version = "=0.2.1" }
# Pinned (and referenced via `use esp_rom_sys as _` in lib.rs so it survives
# `cargo package`): esp-hal 1.1.0 calls esp_rom_sys::init_syscall_table, added
# in 0.1.4, but only constrains it to ~0.1 — without this pin a stock resolve
# drifts to 0.1.1 (which lacks the function) and esp-hal fails to compile.
esp-rom-sys         = { version = "=0.1.4" }

# embedded-hal family
embedded-hal        = "1.0.0"
embedded-io-async   = "0.7.0"

# Embassy
embassy-executor    = { version = "0.10.0", features = ["nightly"] }
embassy-futures     = "0.1"
embassy-net         = { version = "0.8.0", optional = true, default-features = false, features = ["dhcpv4", "proto-ipv4", "medium-ethernet", "tcp", "udp", "dns"] }
embassy-sync        = "0.8"
embassy-time        = "0.5.0"

# misc
allocator-api2      = { version = "0.3.0", default-features = false, features = ["alloc"], optional = true }
fixed               = "1.29.0"
heapless            = { version = "0.9.1", features = ["nightly"] }
log                 = "0.4"
static_cell         = { version = "2.1.1", features = ["nightly"] }
thiserror-no-std    = "2.0.2"

# Local/example builds only: redirect the esp-hal family the library declares
# (stock, above) to the emobotics fork at a pinned rev — a coherent snapshot of
# those versions with the SPI/DMA patches the examples need. Pinned to a rev,
# not the floating `local` branch, so builds are reproducible. `cargo publish`
# ignores [patch], so downstream consumers resolve the stock crates.io versions.
[patch.crates-io]
esp-hal     = { git = "https://github.com/emobotics-dev/esp-hal.git", rev = "3481e981dffb7405530d0425eb3f4b2fedfbc4b6" }
esp-radio   = { git = "https://github.com/emobotics-dev/esp-hal.git", rev = "3481e981dffb7405530d0425eb3f4b2fedfbc4b6" }
esp-sync    = { git = "https://github.com/emobotics-dev/esp-hal.git", rev = "3481e981dffb7405530d0425eb3f4b2fedfbc4b6" }
esp-alloc   = { git = "https://github.com/emobotics-dev/esp-hal.git", rev = "3481e981dffb7405530d0425eb3f4b2fedfbc4b6" }
esp-rom-sys = { git = "https://github.com/emobotics-dev/esp-hal.git", rev = "3481e981dffb7405530d0425eb3f4b2fedfbc4b6" }

[workspace]
members = ["examples/common", "examples/fire27", "examples/cores3", "examples/lvgl"]

[profile.dev]
opt-level = "s"

[profile.release]
codegen-units = 1
debug = 2
debug-assertions = false
incremental = false
lto = "fat"
opt-level = "s"
overflow-checks = true