mirror of
https://github.com/esp-rs/esp-idf-hal.git
synced 2025-09-26 20:00:35 +00:00
Prep for a new release
This commit is contained in:
parent
c8f5bd88f0
commit
5532468962
@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
## [?.??.?] - ????-??-??
|
## [?.??.?] - ????-??-??
|
||||||
|
* MSRV 1.75; remove the nightly feature flag from all async trait implementations
|
||||||
|
* Update public dependencies `e-hal` to 1.0.0-rc3 and `embassy-sync` to 0.5 and private dependency `heapless` to 0.8
|
||||||
* Allow `cargo check --all-features` to work correctly (there used to be a build error when both the `esp-idf-sys` and the `riscv-ulp-hal` features were enabled)
|
* Allow `cargo check --all-features` to work correctly (there used to be a build error when both the `esp-idf-sys` and the `riscv-ulp-hal` features were enabled)
|
||||||
* #351 - Remove the `OutputPin` requirement from SPI SDI pin
|
* #351 - Remove the `OutputPin` requirement from SPI SDI pin
|
||||||
* #350 - Not checking for ESP_FAIL in AsyncCanDriver::transmit
|
* #350 - Not checking for ESP_FAIL in AsyncCanDriver::transmit
|
||||||
|
18
Cargo.toml
18
Cargo.toml
@ -13,7 +13,7 @@ readme = "README.md"
|
|||||||
links = "esp_idf_hal"
|
links = "esp_idf_hal"
|
||||||
build = "build.rs"
|
build = "build.rs"
|
||||||
documentation = "https://esp-rs.github.io/esp-idf-hal/"
|
documentation = "https://esp-rs.github.io/esp-idf-hal/"
|
||||||
rust-version = "1.71"
|
rust-version = "1.75"
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
|
esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
|
||||||
@ -22,7 +22,7 @@ esp-idf-sys = { git = "https://github.com/esp-rs/esp-idf-sys" }
|
|||||||
default = ["std", "binstart"]
|
default = ["std", "binstart"]
|
||||||
std = ["alloc", "esp-idf-sys/std"]
|
std = ["alloc", "esp-idf-sys/std"]
|
||||||
alloc = []
|
alloc = []
|
||||||
nightly = ["embedded-hal-async", "embedded-io-async"]
|
nightly = []
|
||||||
esp-idf-sys = ["dep:esp-idf-sys", "atomic-waker"]
|
esp-idf-sys = ["dep:esp-idf-sys", "atomic-waker"]
|
||||||
riscv-ulp-hal = []
|
riscv-ulp-hal = []
|
||||||
wake-from-isr = [] # Only enable if you plan to use the `edge-executor` crate
|
wake-from-isr = [] # Only enable if you plan to use the `edge-executor` crate
|
||||||
@ -39,20 +39,20 @@ libstart = ["esp-idf-sys/libstart"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
nb = "1.0.0"
|
nb = "1.0.0"
|
||||||
embedded-can = "0.4.1"
|
embedded-can = "0.4.1"
|
||||||
embedded-hal = "=1.0.0-rc.1"
|
embedded-hal = "=1.0.0-rc.3"
|
||||||
embedded-hal-0-2 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] }
|
embedded-hal-0-2 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] }
|
||||||
embedded-hal-nb = "=1.0.0-rc.1"
|
embedded-hal-nb = "=1.0.0-rc.3"
|
||||||
embedded-hal-async = { version = "=1.0.0-rc.1", optional = true }
|
embedded-hal-async = "=1.0.0-rc.3"
|
||||||
embedded-io = "0.6"
|
embedded-io = "0.6"
|
||||||
embedded-io-async = { version = "0.6", optional = true }
|
embedded-io-async = "0.6"
|
||||||
esp-idf-sys = { version = "0.33.5", optional = true, default-features = false, features = ["native"] }
|
esp-idf-sys = { version = "0.33.7", optional = true, default-features = false }
|
||||||
critical-section = { version = "1.1.1", optional = true }
|
critical-section = { version = "1.1.1", optional = true }
|
||||||
heapless = "0.7"
|
heapless = "0.8"
|
||||||
num_enum = { version = "0.7", default-features = false }
|
num_enum = { version = "0.7", default-features = false }
|
||||||
enumset = { version = "1", default-features = false }
|
enumset = { version = "1", default-features = false }
|
||||||
log = { version = "0.4", default-features = false }
|
log = { version = "0.4", default-features = false }
|
||||||
atomic-waker = { version = "1.1.1", optional = true, default-features = false }
|
atomic-waker = { version = "1.1.1", optional = true, default-features = false }
|
||||||
embassy-sync = { version = "0.3" }
|
embassy-sync = { version = "0.5" }
|
||||||
|
|
||||||
[build-dependencies]
|
[build-dependencies]
|
||||||
embuild = "0.31.3"
|
embuild = "0.31.3"
|
||||||
|
@ -1 +1 @@
|
|||||||
future-size-threshold = 50
|
future-size-threshold = 900
|
||||||
|
@ -1344,7 +1344,6 @@ pub mod continuous {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_adc_continuous_isr_iram_safe))]
|
#[cfg(not(esp_idf_adc_continuous_isr_iram_safe))]
|
||||||
impl<'d> embedded_io_async::Read for AdcDriver<'d> {
|
impl<'d> embedded_io_async::Read for AdcDriver<'d> {
|
||||||
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
|
async fn read(&mut self, buf: &mut [u8]) -> Result<usize, Self::Error> {
|
||||||
|
59
src/delay.rs
59
src/delay.rs
@ -99,9 +99,14 @@ extern "C" {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Ets {
|
impl Ets {
|
||||||
|
#[deprecated = "Use delay_ns instead"]
|
||||||
pub fn delay_us(us: u32) {
|
pub fn delay_us(us: u32) {
|
||||||
|
Self::delay_ns(us)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn delay_ns(ns: u32) {
|
||||||
unsafe {
|
unsafe {
|
||||||
ets_delay_us(us);
|
ets_delay_us(ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,19 +119,19 @@ impl Ets {
|
|||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for Ets {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for Ets {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_us(&mut self, us: u32) {
|
||||||
Ets::delay_us(us);
|
Ets::delay_ns(us);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for Ets {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for Ets {
|
||||||
fn delay_us(&mut self, us: u16) {
|
fn delay_us(&mut self, us: u16) {
|
||||||
Ets::delay_us(us as _);
|
Ets::delay_ns(us as _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u8> for Ets {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u8> for Ets {
|
||||||
fn delay_us(&mut self, us: u8) {
|
fn delay_us(&mut self, us: u8) {
|
||||||
Ets::delay_us(us as _);
|
Ets::delay_ns(us as _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,9 +153,9 @@ impl embedded_hal_0_2::blocking::delay::DelayMs<u8> for Ets {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal::delay::DelayUs for Ets {
|
impl embedded_hal::delay::DelayNs for Ets {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_ns(&mut self, ns: u32) {
|
||||||
Ets::delay_us(us)
|
Ets::delay_ns(ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delay_ms(&mut self, ms: u32) {
|
fn delay_ms(&mut self, ms: u32) {
|
||||||
@ -166,8 +171,13 @@ impl embedded_hal::delay::DelayUs for Ets {
|
|||||||
pub struct FreeRtos;
|
pub struct FreeRtos;
|
||||||
|
|
||||||
impl FreeRtos {
|
impl FreeRtos {
|
||||||
|
#[deprecated = "Use delay_ns instead"]
|
||||||
pub fn delay_us(us: u32) {
|
pub fn delay_us(us: u32) {
|
||||||
let ms = us / 1000;
|
Self::delay_ns(us)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn delay_ns(ns: u32) {
|
||||||
|
let ms = ns / 1000;
|
||||||
|
|
||||||
Self::delay_ms(ms);
|
Self::delay_ms(ms);
|
||||||
}
|
}
|
||||||
@ -184,19 +194,19 @@ impl FreeRtos {
|
|||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for FreeRtos {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for FreeRtos {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_us(&mut self, us: u32) {
|
||||||
FreeRtos::delay_us(us);
|
FreeRtos::delay_ns(us);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for FreeRtos {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for FreeRtos {
|
||||||
fn delay_us(&mut self, us: u16) {
|
fn delay_us(&mut self, us: u16) {
|
||||||
FreeRtos::delay_us(us as _);
|
FreeRtos::delay_ns(us as _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u8> for FreeRtos {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u8> for FreeRtos {
|
||||||
fn delay_us(&mut self, us: u8) {
|
fn delay_us(&mut self, us: u8) {
|
||||||
FreeRtos::delay_us(us as _);
|
FreeRtos::delay_ns(us as _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,9 +228,9 @@ impl embedded_hal_0_2::blocking::delay::DelayMs<u8> for FreeRtos {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal::delay::DelayUs for FreeRtos {
|
impl embedded_hal::delay::DelayNs for FreeRtos {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_ns(&mut self, ns: u32) {
|
||||||
FreeRtos::delay_us(us)
|
FreeRtos::delay_ns(ns)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delay_ms(&mut self, ms: u32) {
|
fn delay_ms(&mut self, ms: u32) {
|
||||||
@ -243,11 +253,16 @@ impl Delay {
|
|||||||
Self(threshold)
|
Self(threshold)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[deprecated = "Use delay_ns instead"]
|
||||||
pub fn delay_us(&self, us: u32) {
|
pub fn delay_us(&self, us: u32) {
|
||||||
if us < self.0 {
|
self.delay_ns(us)
|
||||||
Ets::delay_us(us);
|
}
|
||||||
|
|
||||||
|
pub fn delay_ns(&self, ns: u32) {
|
||||||
|
if ns < self.0 {
|
||||||
|
Ets::delay_ns(ns);
|
||||||
} else {
|
} else {
|
||||||
FreeRtos::delay_us(us);
|
FreeRtos::delay_ns(ns);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -260,9 +275,9 @@ impl Delay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal::delay::DelayUs for Delay {
|
impl embedded_hal::delay::DelayNs for Delay {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_ns(&mut self, us: u32) {
|
||||||
Delay::delay_us(self, us)
|
Delay::delay_ns(self, us)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn delay_ms(&mut self, ms: u32) {
|
fn delay_ms(&mut self, ms: u32) {
|
||||||
@ -272,13 +287,13 @@ impl embedded_hal::delay::DelayUs for Delay {
|
|||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for Delay {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u16> for Delay {
|
||||||
fn delay_us(&mut self, us: u16) {
|
fn delay_us(&mut self, us: u16) {
|
||||||
Delay::delay_us(self, us as _);
|
Delay::delay_ns(self, us as _);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for Delay {
|
impl embedded_hal_0_2::blocking::delay::DelayUs<u32> for Delay {
|
||||||
fn delay_us(&mut self, us: u32) {
|
fn delay_us(&mut self, us: u32) {
|
||||||
Delay::delay_us(self, us);
|
Delay::delay_ns(self, us);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
40
src/gpio.rs
40
src/gpio.rs
@ -1420,11 +1420,24 @@ impl<'d, T: Pin, MODE> embedded_hal::digital::InputPin for PinDriver<'d, T, MODE
|
|||||||
where
|
where
|
||||||
MODE: InputMode,
|
MODE: InputMode,
|
||||||
{
|
{
|
||||||
fn is_high(&self) -> Result<bool, Self::Error> {
|
fn is_high(&mut self) -> Result<bool, Self::Error> {
|
||||||
Ok(PinDriver::is_high(self))
|
Ok(PinDriver::is_high(self))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_low(&self) -> Result<bool, Self::Error> {
|
fn is_low(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
Ok(PinDriver::is_low(self))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'d, T: Pin, MODE> embedded_hal::digital::InputPin for &PinDriver<'d, T, MODE>
|
||||||
|
where
|
||||||
|
MODE: InputMode,
|
||||||
|
{
|
||||||
|
fn is_high(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
Ok(PinDriver::is_high(self))
|
||||||
|
}
|
||||||
|
|
||||||
|
fn is_low(&mut self) -> Result<bool, Self::Error> {
|
||||||
Ok(PinDriver::is_low(self))
|
Ok(PinDriver::is_low(self))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1461,15 +1474,29 @@ impl<'d, T: Pin, MODE> embedded_hal::digital::StatefulOutputPin for PinDriver<'d
|
|||||||
where
|
where
|
||||||
MODE: OutputMode,
|
MODE: OutputMode,
|
||||||
{
|
{
|
||||||
fn is_set_high(&self) -> Result<bool, Self::Error> {
|
fn is_set_high(&mut self) -> Result<bool, Self::Error> {
|
||||||
Ok(self.get_output_level().into())
|
Ok(self.get_output_level().into())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_set_low(&self) -> Result<bool, Self::Error> {
|
fn is_set_low(&mut self) -> Result<bool, Self::Error> {
|
||||||
Ok(!bool::from(self.get_output_level()))
|
Ok(!bool::from(self.get_output_level()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Will become possible once the `PinDriver::setXXX`` methods become non-`&mut`, which they really are, internally
|
||||||
|
// impl<'d, T: Pin, MODE> embedded_hal::digital::StatefulOutputPin for &PinDriver<'d, T, MODE>
|
||||||
|
// where
|
||||||
|
// MODE: OutputMode,
|
||||||
|
// {
|
||||||
|
// fn is_set_high(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
// Ok(self.get_output_level().into())
|
||||||
|
// }
|
||||||
|
|
||||||
|
// fn is_set_low(&mut self) -> Result<bool, Self::Error> {
|
||||||
|
// Ok(!bool::from(self.get_output_level()))
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
impl<'d, T: Pin, MODE> embedded_hal_0_2::digital::v2::StatefulOutputPin for PinDriver<'d, T, MODE>
|
impl<'d, T: Pin, MODE> embedded_hal_0_2::digital::v2::StatefulOutputPin for PinDriver<'d, T, MODE>
|
||||||
where
|
where
|
||||||
MODE: OutputMode,
|
MODE: OutputMode,
|
||||||
@ -1504,10 +1531,7 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(all(
|
#[cfg(not(all(feature = "riscv-ulp-hal", not(feature = "esp-idf-sys"))))]
|
||||||
not(all(feature = "riscv-ulp-hal", not(feature = "esp-idf-sys"))),
|
|
||||||
feature = "nightly"
|
|
||||||
))]
|
|
||||||
impl<T: Pin, MODE: InputMode> embedded_hal_async::digital::Wait for PinDriver<'_, T, MODE> {
|
impl<T: Pin, MODE: InputMode> embedded_hal_async::digital::Wait for PinDriver<'_, T, MODE> {
|
||||||
async fn wait_for_high(&mut self) -> Result<(), GpioError> {
|
async fn wait_for_high(&mut self) -> Result<(), GpioError> {
|
||||||
self.wait_for_high().await?;
|
self.wait_for_high().await?;
|
||||||
|
@ -1236,7 +1236,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_version_major = "4"))]
|
#[cfg(not(esp_idf_version_major = "4"))]
|
||||||
impl<'d, Dir> embedded_io_async::Read for I2sDriver<'d, Dir>
|
impl<'d, Dir> embedded_io_async::Read for I2sDriver<'d, Dir>
|
||||||
where
|
where
|
||||||
@ -1247,7 +1246,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_version_major = "4"))]
|
#[cfg(not(esp_idf_version_major = "4"))]
|
||||||
impl<'d, Dir> embedded_io_async::Write for I2sDriver<'d, Dir>
|
impl<'d, Dir> embedded_io_async::Write for I2sDriver<'d, Dir>
|
||||||
where
|
where
|
||||||
|
@ -30,7 +30,6 @@ impl Display for EspIOError {
|
|||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl std::error::Error for EspIOError {}
|
impl std::error::Error for EspIOError {}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
pub mod asynch {
|
pub mod asynch {
|
||||||
pub use embedded_io_async::*;
|
pub use embedded_io_async::*;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ fn to_pwm_err(err: EspError) -> PwmError {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'d> embedded_hal::pwm::SetDutyCycle for LedcDriver<'d> {
|
impl<'d> embedded_hal::pwm::SetDutyCycle for LedcDriver<'d> {
|
||||||
fn get_max_duty_cycle(&self) -> u16 {
|
fn max_duty_cycle(&self) -> u16 {
|
||||||
let duty = self.get_max_duty();
|
let duty = self.get_max_duty();
|
||||||
let duty_cap: u16 = if duty > u16::MAX as u32 {
|
let duty_cap: u16 = if duty > u16::MAX as u32 {
|
||||||
u16::MAX
|
u16::MAX
|
||||||
@ -354,7 +354,7 @@ impl<'d> embedded_hal::pwm::SetDutyCycle for LedcDriver<'d> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) -> Result<(), PwmError> {
|
fn set_duty_cycle_fraction(&mut self, num: u16, denom: u16) -> Result<(), PwmError> {
|
||||||
let duty = num as u32 * self.get_max_duty_cycle() as u32 / denom as u32;
|
let duty = num as u32 * self.max_duty_cycle() as u32 / denom as u32;
|
||||||
self.set_duty_cycle(duty as u16)
|
self.set_duty_cycle(duty as u16)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,11 +1,7 @@
|
|||||||
#![cfg_attr(not(feature = "std"), no_std)]
|
#![cfg_attr(not(feature = "std"), no_std)]
|
||||||
#![allow(stable_features)]
|
#![allow(async_fn_in_trait)]
|
||||||
#![allow(unknown_lints)]
|
|
||||||
#![allow(clippy::unused_unit)] // enumset
|
#![allow(clippy::unused_unit)] // enumset
|
||||||
#![warn(clippy::large_futures)]
|
#![warn(clippy::large_futures)]
|
||||||
#![cfg_attr(feature = "nightly", feature(async_fn_in_trait))]
|
|
||||||
#![cfg_attr(feature = "nightly", allow(async_fn_in_trait))]
|
|
||||||
#![cfg_attr(feature = "nightly", feature(impl_trait_projections))]
|
|
||||||
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
#![cfg_attr(feature = "nightly", feature(doc_cfg))]
|
||||||
#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
|
#![cfg_attr(target_arch = "xtensa", feature(asm_experimental_arch))]
|
||||||
|
|
||||||
|
15
src/spi.rs
15
src/spi.rs
@ -673,7 +673,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
||||||
impl<'d, T> embedded_hal_async::spi::SpiBus for SpiBusDriver<'d, T>
|
impl<'d, T> embedded_hal_async::spi::SpiBus for SpiBusDriver<'d, T>
|
||||||
where
|
where
|
||||||
@ -904,7 +903,7 @@ where
|
|||||||
|
|
||||||
while spi_operations.peek().is_some() {
|
while spi_operations.peek().is_some() {
|
||||||
if let Some(SpiOperation::Delay(delay)) = spi_operations.peek() {
|
if let Some(SpiOperation::Delay(delay)) = spi_operations.peek() {
|
||||||
delay_impl.delay_us(*delay);
|
delay_impl.delay_ns(*delay);
|
||||||
spi_operations.next();
|
spi_operations.next();
|
||||||
} else {
|
} else {
|
||||||
let transactions = core::iter::from_fn(|| {
|
let transactions = core::iter::from_fn(|| {
|
||||||
@ -965,7 +964,7 @@ where
|
|||||||
|
|
||||||
while spi_operations.peek().is_some() {
|
while spi_operations.peek().is_some() {
|
||||||
if let Some(SpiOperation::Delay(delay)) = spi_operations.peek() {
|
if let Some(SpiOperation::Delay(delay)) = spi_operations.peek() {
|
||||||
delay_impl.delay_us(*delay);
|
delay_impl.delay_ns(*delay);
|
||||||
spi_operations.next();
|
spi_operations.next();
|
||||||
} else {
|
} else {
|
||||||
let transactions = core::iter::from_fn(|| {
|
let transactions = core::iter::from_fn(|| {
|
||||||
@ -1091,7 +1090,7 @@ where
|
|||||||
spi_transfer_in_place_transactions(words, chunk_size)
|
spi_transfer_in_place_transactions(words, chunk_size)
|
||||||
.map(SpiOperation::Transaction),
|
.map(SpiOperation::Transaction),
|
||||||
),
|
),
|
||||||
Operation::DelayUs(delay) => {
|
Operation::DelayNs(delay) => {
|
||||||
OperationsIter::Delay(core::iter::once(SpiOperation::Delay(delay)))
|
OperationsIter::Delay(core::iter::once(SpiOperation::Delay(delay)))
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -1241,7 +1240,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
||||||
impl<'d, T> embedded_hal_async::spi::SpiDevice for SpiDeviceDriver<'d, T>
|
impl<'d, T> embedded_hal_async::spi::SpiDevice for SpiDeviceDriver<'d, T>
|
||||||
where
|
where
|
||||||
@ -1473,7 +1471,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
#[cfg(not(esp_idf_spi_master_isr_in_iram))]
|
||||||
impl<'d, DEVICE, DRIVER> embedded_hal_async::spi::SpiDevice
|
impl<'d, DEVICE, DRIVER> embedded_hal_async::spi::SpiDevice
|
||||||
for SpiSoftCsDeviceDriver<'d, DEVICE, DRIVER>
|
for SpiSoftCsDeviceDriver<'d, DEVICE, DRIVER>
|
||||||
@ -1573,7 +1570,7 @@ where
|
|||||||
|
|
||||||
// TODO: Need to wait asnchronously if in async mode
|
// TODO: Need to wait asnchronously if in async mode
|
||||||
if let Some(delay) = pre_delay {
|
if let Some(delay) = pre_delay {
|
||||||
Ets::delay_us(*delay);
|
Ets::delay_ns(*delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1586,7 +1583,7 @@ where
|
|||||||
|
|
||||||
// TODO: Need to wait asnchronously if in async mode
|
// TODO: Need to wait asnchronously if in async mode
|
||||||
if let Some(delay) = post_delay {
|
if let Some(delay) = post_delay {
|
||||||
Ets::delay_us(*delay);
|
Ets::delay_ns(*delay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1898,7 +1895,7 @@ fn copy_operation<'b>(operation: &'b mut Operation<'_, u8>) -> Operation<'b, u8>
|
|||||||
Operation::Write(write) => Operation::Write(write),
|
Operation::Write(write) => Operation::Write(write),
|
||||||
Operation::Transfer(read, write) => Operation::Transfer(read, write),
|
Operation::Transfer(read, write) => Operation::Transfer(read, write),
|
||||||
Operation::TransferInPlace(write) => Operation::TransferInPlace(write),
|
Operation::TransferInPlace(write) => Operation::TransferInPlace(write),
|
||||||
Operation::DelayUs(delay) => Operation::DelayUs(*delay),
|
Operation::DelayNs(delay) => Operation::DelayNs(*delay),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,8 +803,8 @@ pub mod embassy_sync {
|
|||||||
|
|
||||||
#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
|
#[cfg(all(feature = "alloc", target_has_atomic = "ptr"))]
|
||||||
pub mod notification {
|
pub mod notification {
|
||||||
|
use core::marker::PhantomData;
|
||||||
use core::num::NonZeroU32;
|
use core::num::NonZeroU32;
|
||||||
use core::ptr;
|
|
||||||
use core::sync::atomic::{AtomicPtr, Ordering};
|
use core::sync::atomic::{AtomicPtr, Ordering};
|
||||||
|
|
||||||
extern crate alloc;
|
extern crate alloc;
|
||||||
@ -821,13 +821,13 @@ pub mod notification {
|
|||||||
#[cfg(not(esp_idf_version_major = "4"))]
|
#[cfg(not(esp_idf_version_major = "4"))]
|
||||||
type Task = esp_idf_sys::tskTaskControlBlock;
|
type Task = esp_idf_sys::tskTaskControlBlock;
|
||||||
|
|
||||||
pub struct Notification(Arc<Notifier>, *const ());
|
pub struct Notification(Arc<Notifier>, PhantomData<*const ()>);
|
||||||
|
|
||||||
impl Notification {
|
impl Notification {
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
Self(
|
Self(
|
||||||
Arc::new(Notifier(AtomicPtr::new(task::current().unwrap()))),
|
Arc::new(Notifier(AtomicPtr::new(task::current().unwrap()))),
|
||||||
ptr::null(),
|
PhantomData,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -466,10 +466,9 @@ impl<'d> Drop for TimerDriver<'d> {
|
|||||||
|
|
||||||
unsafe impl<'d> Send for TimerDriver<'d> {}
|
unsafe impl<'d> Send for TimerDriver<'d> {}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
impl<'d> embedded_hal_async::delay::DelayNs for TimerDriver<'d> {
|
||||||
impl<'d> embedded_hal_async::delay::DelayUs for TimerDriver<'d> {
|
async fn delay_ns(&mut self, ns: u32) {
|
||||||
async fn delay_us(&mut self, us: u32) {
|
let counter = core::cmp::max((self.tick_hz() * ns as u64) / 1000000, 1);
|
||||||
let counter = core::cmp::max((self.tick_hz() * us as u64) / 1000000, 1);
|
|
||||||
|
|
||||||
self.delay(counter).await.unwrap();
|
self.delay(counter).await.unwrap();
|
||||||
}
|
}
|
||||||
|
@ -1493,7 +1493,6 @@ where
|
|||||||
type Error = EspIOError;
|
type Error = EspIOError;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<'d, T> embedded_io_async::Read for AsyncUartDriver<'d, T>
|
impl<'d, T> embedded_io_async::Read for AsyncUartDriver<'d, T>
|
||||||
where
|
where
|
||||||
T: BorrowMut<UartDriver<'d>>,
|
T: BorrowMut<UartDriver<'d>>,
|
||||||
@ -1503,7 +1502,6 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<'d, T> embedded_io_async::Write for AsyncUartDriver<'d, T>
|
impl<'d, T> embedded_io_async::Write for AsyncUartDriver<'d, T>
|
||||||
where
|
where
|
||||||
T: BorrowMut<UartDriver<'d>>,
|
T: BorrowMut<UartDriver<'d>>,
|
||||||
@ -1613,7 +1611,6 @@ where
|
|||||||
type Error = EspIOError;
|
type Error = EspIOError;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<'d, T> embedded_io_async::Read for AsyncUartRxDriver<'d, T>
|
impl<'d, T> embedded_io_async::Read for AsyncUartRxDriver<'d, T>
|
||||||
where
|
where
|
||||||
T: BorrowMut<UartRxDriver<'d>>,
|
T: BorrowMut<UartRxDriver<'d>>,
|
||||||
@ -1732,7 +1729,6 @@ where
|
|||||||
type Error = EspIOError;
|
type Error = EspIOError;
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "nightly")]
|
|
||||||
impl<'d, T> embedded_io_async::Write for AsyncUartTxDriver<'d, T>
|
impl<'d, T> embedded_io_async::Write for AsyncUartTxDriver<'d, T>
|
||||||
where
|
where
|
||||||
T: BorrowMut<UartTxDriver<'d>>,
|
T: BorrowMut<UartTxDriver<'d>>,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user