Skip to content

Commit d8569c0

Browse files
committed
fold all asyncify types here
1 parent e12df14 commit d8569c0

18 files changed

+1019
-475
lines changed

.cargo/config.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
[build]
2+
target = "riscv32imc-esp-espidf"
3+
14
[target.xtensa-esp32-espidf]
25
linker = "ldproxy"
36
rustflags = ["--cfg", "espidf_time64"]
@@ -19,7 +22,7 @@ linker = "ldproxy"
1922
rustflags = ["--cfg", "espidf_time64"]
2023

2124
[env]
22-
ESP_IDF_SDKCONFIG_DEFAULTS = ".github/configs/sdkconfig.defaults"
25+
ESP_IDF_SDKCONFIG_DEFAULTS = "/home/ivan/dev/esp-idf-svc/.github/configs/sdkconfig.defaults"
2326
ESP_IDF_VERSION = "v5.1.2"
2427

2528
[unstable]

CHANGELOG.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [?.??.?] - ????-??-??
9-
* Breaking change in module `mqtt::client`: This is partially due to the breaking change in `embedded_svc::mqtt::client`, but additionally:
10-
* All event conversion logic now retired, significantly simplifying the type signatures of `EspMqttClient` and `EspMqttConnection`, as well as the number of offered constructors
11-
* For MQTT events, user always gets an instance of `EspMqttEvent` which implements the `embedded_svc::mqtt::client::Event` trait - valid for both callback-based event processing as well as for connection-based blocking and asynchronous event processing
12-
* Breaking change in module `http::server`: This is due to the breaking change in `embedded_svc::http::server`, whereas `HandlerError` and `HandlerResult` were removed. Check the Changelog of `embedded_svc` for more details
9+
* Breaking changes in module `eventloop`:
10+
* All async post/receive functionality now implemented directly on the `esp-idf-svc` event loop types, as the `embedded_svc::utils::asyncify` module is now gone
11+
* Types `EspTypedEventLoop` and `EspPostbox` are now retired. Use `EspEventLoop` directly, as it has the same functionality
12+
* Trait `EspTypedEventSource` is now marked as unsafe (i.e., implementors should do `unsafe impl EspTypedEventSource for ...`); check the documentation of the trait for justification
13+
* Breaking changes in module `http::server`:
14+
* All async WS functionality now implemented directly on the `esp-idf-svc` HTTP types, as the `embedded_svc::utils::asyncify` module is now gone
15+
* Due to the breaking change in `embedded_svc::http::server`, whereas `HandlerError` and `HandlerResult` were removed, these types are no longer used in the `embedded_svc::http::server` module either. Check the Changelog of `embedded_svc` for more details
16+
* Breaking change in module `timer`: all async timer functionality now implemented directly on the `esp-idf-svc` timer types, as the `embedded_svc::utils::asyncify` module is now gone
17+
* Breaking changes in module `mqtt::client`:
18+
* All async send/receive functionality now implemented directly on the `esp-idf-svc` MQTT types, as the `embedded_svc::utils::asyncify` module is now gone
19+
* Changes induced by breaking changes in `embedded_svc::mqtt::client` API contract:
20+
* All event conversion logic now retired, significantly simplifying the type signatures of `EspMqttClient` and `EspMqttConnection`, as well as the number of offered constructors
21+
* For MQTT events, user always gets an instance of `EspMqttEvent` which implements the `embedded_svc::mqtt::client::Event` trait - valid for both callback-based event processing as well as for connection-based blocking and asynchronous event processing
1322
* MSRV 1.75; remove the nightly feature flag from all async trait implementations
1423
* Update public dependency `heapless` to 0.8
1524
* Remove dependency on `embassy-time` and replace it with a dependency on `embassy-time-driver`; get rid of the custom embassy time queue as it was anyway re-implementing something like a generic timer queue, which is available in the `embassy-time` crate (with its feature `generic-queue` enabled)
16-
* #316 - BREAKING CHANGE addressing a typo - `http::server::Configuration::max_resp_handlers` renamed to `http::server::Configuration::max_resp_headers`
25+
* #316 - breaking change addressing a typo - `http::server::Configuration::max_resp_handlers` renamed to `http::server::Configuration::max_resp_headers`
1726
* #319 - Set default TTL in `EspPing` to 64
1827
* #322 - Fix MQTT PSK code (did not compile)
1928
* #323 - ETH example with a statically configured IP

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ num_enum = { version = "0.7", default-features = false }
4747
enumset = { version = "1", default-features = false }
4848
log = { version = "0.4", default-features = false }
4949
uncased = { version = "0.9.7", default-features = false }
50-
embedded-svc = { version = "0.26.4", default-features = false, features = ["asyncify"] }
50+
embedded-hal-async = { version = "1", default-features = false }
51+
embedded-svc = { version = "0.26.4", default-features = false }
5152
esp-idf-hal = { version = "0.42.5", default-features = false }
5253
embassy-time-driver = { version = "0.1", optional = true, features = ["tick-hz-1_000_000"] }
5354
embassy-futures = "0.1"

src/espnow.rs

+4-6
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,18 @@ use alloc::boxed::Box;
1414

1515
use crate::sys::*;
1616

17-
use crate::private::mutex::{Mutex, RawMutex};
17+
use crate::private::mutex::Mutex;
1818

1919
type Singleton<T> = Mutex<Option<Box<T>>>;
2020

2121
pub const BROADCAST: [u8; 6] = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF];
2222

2323
#[allow(clippy::type_complexity)]
24-
static RECV_CALLBACK: Singleton<dyn FnMut(&[u8], &[u8]) + Send + 'static> =
25-
Mutex::wrap(RawMutex::new(), None);
24+
static RECV_CALLBACK: Singleton<dyn FnMut(&[u8], &[u8]) + Send + 'static> = Mutex::new(None);
2625
#[allow(clippy::type_complexity)]
27-
static SEND_CALLBACK: Singleton<dyn FnMut(&[u8], SendStatus) + Send + 'static> =
28-
Mutex::wrap(RawMutex::new(), None);
26+
static SEND_CALLBACK: Singleton<dyn FnMut(&[u8], SendStatus) + Send + 'static> = Mutex::new(None);
2927

30-
static TAKEN: Mutex<bool> = Mutex::wrap(RawMutex::new(), false);
28+
static TAKEN: Mutex<bool> = Mutex::new(false);
3129

3230
#[derive(Debug)]
3331
pub enum SendStatus {

src/eth.rs

+5-15
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,7 @@ impl EthEvent {
10051005
}
10061006
}
10071007

1008-
impl EspTypedEventSource for EthEvent {
1008+
unsafe impl EspTypedEventSource for EthEvent {
10091009
fn source() -> *const ffi::c_char {
10101010
unsafe { ETH_EVENT }
10111011
}
@@ -1218,13 +1218,8 @@ where
12181218
mut matcher: F,
12191219
timeout: Option<Duration>,
12201220
) -> Result<(), EspError> {
1221-
use embedded_svc::utils::asyncify::event_bus::AsyncEventBus;
1222-
use embedded_svc::utils::asyncify::timer::AsyncTimerService;
1223-
1224-
let event_loop = AsyncEventBus::new((), self.event_loop.clone());
1225-
let timer_service = AsyncTimerService::new(self.timer_service.clone());
1226-
1227-
let mut wait = crate::eventloop::AsyncWait::<EthEvent, _>::new(event_loop, timer_service)?;
1221+
let mut wait =
1222+
crate::eventloop::AsyncWait::<EthEvent, _>::new(&self.event_loop, &self.timer_service)?;
12281223

12291224
wait.wait_while(|| matcher(self), timeout).await
12301225
}
@@ -1250,13 +1245,8 @@ where
12501245
mut matcher: F,
12511246
timeout: Option<core::time::Duration>,
12521247
) -> Result<(), EspError> {
1253-
use embedded_svc::utils::asyncify::event_bus::AsyncEventBus;
1254-
use embedded_svc::utils::asyncify::timer::AsyncTimerService;
1255-
1256-
let event_loop = AsyncEventBus::new((), self.event_loop.clone());
1257-
let timer_service = AsyncTimerService::new(self.timer_service.clone());
1258-
1259-
let mut wait = crate::eventloop::AsyncWait::<IpEvent, _>::new(event_loop, timer_service)?;
1248+
let mut wait =
1249+
crate::eventloop::AsyncWait::<IpEvent, _>::new(&self.event_loop, &self.timer_service)?;
12601250

12611251
wait.wait_while(|| matcher(self), timeout).await
12621252
}

0 commit comments

Comments
 (0)