diff --git a/.cargo/config.toml b/.cargo/config.toml index 59ccc74..703b870 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,12 +5,13 @@ target = "xtensa-esp32-espidf" linker = "ldproxy" # runner = "espflash --monitor" # Select this runner for espflash v1.x.x runner = "espflash flash --monitor" # Select this runner for espflash v2.x.x - +rustflags = [ "--cfg", "espidf_time64"] # Extending time_t for ESP IDF 5: https://github.com/esp-rs/rust/issues/110 [unstable] build-std = ["std", "panic_abort"] [env] # Note: these variables are not used when using pio builder (`cargo build --features pio`) -ESP_IDF_VERSION = "release/v4.4" +ESP_IDF_VERSION = "release/v5.1" +ESP_IDF_PATH_ISSUES = "warn" # or "ignore" diff --git a/Cargo.toml b/Cargo.toml index ac0c17b..37f1514 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,23 +15,18 @@ opt-level = "z" [features] -default = ["std", "hal", "esp-idf-sys/native"] +default = ["std", "embassy", "esp-idf-svc/native"] +pio = ["esp-idf-svc/pio"] +std = ["alloc", "esp-idf-svc/binstart", "esp-idf-svc/std"] +alloc = ["esp-idf-svc/alloc"] +nightly = ["esp-idf-svc/nightly"] +experimental = ["esp-idf-svc/experimental"] +embassy = ["esp-idf-svc/embassy-sync", "esp-idf-svc/critical-section", "esp-idf-svc/embassy-time-driver"] -pio = ["esp-idf-sys/pio"] -all = ["std", "nightly", "experimental", "embassy"] -hal = ["esp-idf-hal", "embedded-svc", "esp-idf-svc"] -std = ["alloc", "esp-idf-sys/std", "esp-idf-sys/binstart", "embedded-svc?/std", "esp-idf-hal?/std", "esp-idf-svc?/std"] -alloc = ["embedded-svc?/alloc", "esp-idf-hal?/alloc", "esp-idf-svc?/alloc"] -nightly = ["embedded-svc?/nightly", "esp-idf-svc?/nightly"] # Future: "esp-idf-hal?/nightly" -experimental = ["embedded-svc?/experimental", "esp-idf-svc?/experimental"] -embassy = ["esp-idf-hal?/embassy-sync", "esp-idf-hal?/critical-section", "esp-idf-hal?/edge-executor", "esp-idf-svc?/embassy-time-driver", "esp-idf-svc?/embassy-time-isr-queue"] - [dependencies] log = { version = "0.4.17", default-features = false } -esp-idf-sys = { version = "0.33", default-features = false } -esp-idf-hal = { version = "0.41", optional = true, default-features = false } -esp-idf-svc = { version = "0.46", optional = true, default-features = false } +esp-idf-svc = { version = "0.47.3", default-features = false } embedded-svc = { version = "0.25", optional = true, default-features = false } nmea-parser = "0.10.0" embedded-graphics = "0.8.0" diff --git a/build.rs b/build.rs index ccb6e75..c59899a 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,5 @@ // Necessary because of this issue: https://github.com/rust-lang/cargo/issues/9641 fn main() -> Result<(), Box> { - embuild::build::CfgArgs::output_propagated("ESP_IDF")?; - embuild::build::LinkArgs::output_propagated("ESP_IDF")?; + embuild::espidf::sysenv::output(); Ok(()) } diff --git a/src/display/mod.rs b/src/display/mod.rs index f9c2817..7a33ec2 100644 --- a/src/display/mod.rs +++ b/src/display/mod.rs @@ -9,7 +9,9 @@ use embedded_graphics::{ text::{Alignment, Text}, }; -use esp_idf_hal::i2c::I2cDriver; +use esp_idf_svc::hal::i2c::I2cDriver; + + use ssd1306::{ prelude::*, rotation::DisplayRotation, size::DisplaySize, I2CDisplayInterface, Ssd1306, diff --git a/src/error.rs b/src/error.rs index 87e2686..b7ac660 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,4 +1,4 @@ -use esp_idf_sys::EspError; +use esp_idf_svc::sys::EspError; use crate::display::DisplayError; use crate::gps::GpsError; diff --git a/src/gps/mod.rs b/src/gps/mod.rs index c91c792..1f4b85c 100644 --- a/src/gps/mod.rs +++ b/src/gps/mod.rs @@ -1,4 +1,4 @@ -use esp_idf_hal::{ +use esp_idf_svc::hal::{ self, peripheral::Peripheral, gpio::{AnyInputPin, AnyOutputPin, InputPin}, diff --git a/src/main.rs b/src/main.rs index 74d949d..691ac3b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,13 +1,12 @@ #![allow(unused)] -use esp_idf_hal::{ +use esp_idf_svc::hal::{ self, gpio::*, i2c::{I2cConfig, I2cDriver}, prelude::Peripherals, units::Hertz, }; -use esp_idf_sys as _; // If using the `binstart` feature of `esp-idf-sys`, always keep this module imported use std::sync::atomic::{AtomicBool, Ordering}; @@ -26,7 +25,7 @@ use ssd1306::prelude::*; fn main() -> Result<(), Error> { // It is necessary to call this function once. Otherwise some patches to the runtime // implemented by esp-idf-sys might not link properly. See https://github.com/esp-rs/esp-idf-template/issues/71 - esp_idf_sys::link_patches(); + esp_idf_svc::sys::link_patches(); // Bind the log crate to the ESP Logging facilities //esp_idf_svc::log::EspLogger::initialize_default();