Skip to content

Commit

Permalink
Fix embassy-time dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
ivmarkov committed Jan 12, 2024
1 parent efa0e75 commit 89606da
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
8 changes: 5 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ std = ["alloc", "log/std", "esp-idf-hal/std", "embedded-svc/std"]
alloc = ["esp-idf-hal/alloc", "embedded-svc/alloc", "uncased/alloc"]
nightly = ["embedded-svc/nightly", "esp-idf-hal/nightly"]
experimental = ["embedded-svc/experimental"]
embassy-time-driver = ["embassy-time"]
embassy-time-isr-queue = ["embassy-sync", "embassy-time", "embassy-sync"]
embassy-time-driver = ["dep:embassy-time-driver"]
embassy-time-queue-driver = ["dep:embassy-time-queue-driver", "embassy-time", "embassy-sync"]

# Propagated esp-idf-hal features
embassy-sync = ["esp-idf-hal/embassy-sync", "dep:embassy-sync"]
Expand All @@ -52,7 +52,9 @@ uncased = { version = "0.9.7", default-features = false }
embedded-svc = { version = "0.26.4", default-features = false, features = ["asyncify"] }
esp-idf-hal = { version = "0.42.5", default-features = false, features = ["esp-idf-sys"] }
embassy-sync = { version = "0.5", optional = true }
embassy-time = { version = "0.2", optional = true, features = ["tick-hz-1_000_000"] }
embassy-time-driver = { version = "0.1", optional = true, features = ["tick-hz-1_000_000"] }
embassy-time-queue-driver = { version = "0.1", optional = true }
embassy-time = { version = "0.3", optional = true }
embassy-futures = "0.1"

[build-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
//! - `std`: Enable the use of std. Enabled by default.
//! - `experimental`: Enable the use of experimental features.
//! - `embassy-time-driver`
//! - `embassy-time-isr-queue`
//! - `embassy-time-queue-queue`
#![cfg_attr(not(feature = "std"), no_std)]
#![feature(async_fn_in_trait)]
#![allow(async_fn_in_trait)]
#![warn(clippy::large_futures)]

#[cfg(feature = "alloc")]
Expand Down
1 change: 1 addition & 0 deletions src/nvs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,7 @@ pub type EspDefaultNvs = EspNvs<NvsDefault>;
pub type EspCustomNvs = EspNvs<NvsCustom>;
pub type EspEncryptedNvs = EspNvs<NvsEncrypted>;

#[allow(dead_code)]
pub struct EspNvs<T: NvsPartitionId>(EspNvsPartition<T>, nvs_handle_t);

impl<T: NvsPartitionId> EspNvs<T> {
Expand Down
16 changes: 8 additions & 8 deletions src/timer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -349,13 +349,13 @@ mod asyncify {
}

pub mod embassy_time {
#[cfg(any(feature = "embassy-time-driver", feature = "embassy-time-isr-queue"))]
#[cfg(any(feature = "embassy-time-driver", feature = "embassy-time-queue-driver"))]
pub mod driver {
use core::cell::UnsafeCell;

use heapless::Vec;

use ::embassy_time::driver::{AlarmHandle, Driver};
use ::embassy_time_driver::{AlarmHandle, Driver};

use crate::hal::task::CriticalSection;

Expand Down Expand Up @@ -483,10 +483,10 @@ pub mod embassy_time {
unsafe { __INTERNAL_REFERENCE }
}

::embassy_time::time_driver_impl!(static DRIVER: EspDriver = EspDriver::new());
::embassy_time_driver::time_driver_impl!(static DRIVER: EspDriver = EspDriver::new());
}

#[cfg(feature = "embassy-time-isr-queue")]
#[cfg(feature = "embassy-time-queue-driver")]
pub mod queue {
#[cfg(esp_idf_esp_timer_supports_isr_dispatch_method)]
use crate::hal::interrupt::embassy_sync::IsrRawMutex as RawMutexImpl;
Expand Down Expand Up @@ -575,7 +575,7 @@ pub mod embassy_time {
(unsafe { __INTERNAL_REFERENCE }, super::driver::link())
}

::embassy_time::timer_queue_impl!(static QUEUE: Queue<RawMutexImpl, AlarmImpl> = Queue::new());
::embassy_time_queue_driver::timer_queue_impl!(static QUEUE: Queue<RawMutexImpl, AlarmImpl> = Queue::new());

mod generic_queue {
use core::cell::RefCell;
Expand All @@ -584,8 +584,8 @@ pub mod embassy_time {

use embassy_sync::blocking_mutex::{raw::RawMutex, Mutex};

use embassy_time::queue::TimerQueue;
use embassy_time::Instant;
use embassy_time_queue_driver::TimerQueue;

use heapless::sorted_linked_list::{LinkedIndexU8, Min, SortedLinkedList};

Expand Down Expand Up @@ -763,8 +763,8 @@ pub mod embassy_time {
}

impl<R: RawMutex, A: Alarm> TimerQueue for Queue<R, A> {
fn schedule_wake(&'static self, at: Instant, waker: &Waker) {
Queue::schedule_wake(self, at, waker);
fn schedule_wake(&'static self, at: u64, waker: &Waker) {
Queue::schedule_wake(self, Instant::from_ticks(at), waker);
}
}
}
Expand Down
1 change: 1 addition & 0 deletions src/wifi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@ impl<'d> WifiDriver<'d> {
let cfg = wifi_init_config_t {
#[cfg(esp_idf_version_major = "4")]
event_handler: Some(esp_event_send_internal),
#[allow(static_mut_ref)]
osi_funcs: unsafe { &mut g_wifi_osi_funcs },
wpa_crypto_funcs: unsafe { g_wifi_default_wpa_crypto_funcs },
static_rx_buf_num: CONFIG_ESP32_WIFI_STATIC_RX_BUFFER_NUM as _,
Expand Down

0 comments on commit 89606da

Please sign in to comment.