From a00643f22d8382ac9751b971cd7776ae70b5c270 Mon Sep 17 00:00:00 2001 From: Kirill Mikhailov <62840029+playfulFence@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:13:10 +0100 Subject: [PATCH] Remove embedded-hal 0.2.x impls and deps from `esp-hal` (#2593) * Initial remove * update ssd1306 driver version * small docs cleanup * migration guide * changelog entry * update changelog entry (move under `Removed` section) * eh migration guide link * `Wait` trait linking --- esp-hal/CHANGELOG.md | 2 +- esp-hal/Cargo.toml | 1 - esp-hal/MIGRATING-0.22.md | 26 +++++ esp-hal/src/analog/adc/esp32.rs | 13 --- esp-hal/src/analog/adc/mod.rs | 21 ---- esp-hal/src/analog/adc/riscv.rs | 14 --- esp-hal/src/analog/adc/xtensa.rs | 14 --- esp-hal/src/delay.rs | 24 +---- esp-hal/src/gpio/mod.rs | 173 +------------------------------ esp-hal/src/gpio/placeholder.rs | 19 ---- esp-hal/src/i2c/master/mod.rs | 43 +------- esp-hal/src/lib.rs | 4 +- esp-hal/src/mcpwm/operator.rs | 33 ------ esp-hal/src/rng.rs | 23 +--- esp-hal/src/rtc_cntl/mod.rs | 30 ------ esp-hal/src/spi/master.rs | 70 +------------ esp-hal/src/timer/mod.rs | 51 --------- esp-hal/src/timer/timg.rs | 33 ------ esp-hal/src/twai/mod.rs | 133 +----------------------- esp-hal/src/uart.rs | 56 ---------- esp-hal/src/usb_serial_jtag.rs | 52 ---------- hil-test/Cargo.toml | 4 +- hil-test/tests/gpio.rs | 4 +- hil-test/tests/twai.rs | 2 +- hil-test/tests/uart.rs | 2 +- qa-test/Cargo.toml | 2 +- 26 files changed, 49 insertions(+), 800 deletions(-) diff --git a/esp-hal/CHANGELOG.md b/esp-hal/CHANGELOG.md index 84c9dd90e..01f0286ec 100644 --- a/esp-hal/CHANGELOG.md +++ b/esp-hal/CHANGELOG.md @@ -41,13 +41,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Removed - Remove more examples. Update doctests. (#2547) - - The `configure` and `configure_for_async` DMA channel functions has been removed (#2403) - The DMA channel objects no longer have `tx` and `rx` fields. (#2526) - `SysTimerAlarms` has been removed, alarms are now part of the `SystemTimer` struct (#2576) - `FrozenUnit`, `AnyUnit`, `SpecificUnit`, `SpecificComparator`, `AnyComparator` have been removed from `systimer` (#2576) - `esp_hal::psram::psram_range` (#2546) - The `Dma` structure has been removed. (#2545) +- Remove `embedded-hal 0.2.x` impls and deps from `esp-hal` (#2593) ## [0.22.0] - 2024-11-20 diff --git a/esp-hal/Cargo.toml b/esp-hal/Cargo.toml index 90d4a6f2b..a5a44892e 100644 --- a/esp-hal/Cargo.toml +++ b/esp-hal/Cargo.toml @@ -31,7 +31,6 @@ embassy-sync = "0.6.1" embassy-usb-driver = { version = "0.1.0", optional = true } embassy-usb-synopsys-otg = { version = "0.1.0", optional = true } embedded-can = "0.4.1" -embedded-hal-02 = { version = "0.2.7", features = ["unproven"], package = "embedded-hal" } embedded-hal = "1.0.0" embedded-hal-async = "1.0.0" embedded-hal-nb = "1.0.0" diff --git a/esp-hal/MIGRATING-0.22.md b/esp-hal/MIGRATING-0.22.md index 8ed0777b4..15cecfe3e 100644 --- a/esp-hal/MIGRATING-0.22.md +++ b/esp-hal/MIGRATING-0.22.md @@ -158,3 +158,29 @@ is enabled. To retrieve the address and size of the initialized external memory, ``` The usage of `esp_alloc::psram_allocator!` remains unchanged. + + +### embedded-hal 0.2.* is not supported anymore. + +As per https://github.com/rust-embedded/embedded-hal/pull/640, our driver no longer implements traits from `embedded-hal 0.2.x`. +Analogs of all traits from the above mentioned version are available in `embedded-hal 1.x.x` + +```diff +- use embedded_hal_02::can::Frame; ++ use embedded_can::Frame; +``` + +```diff +- use embedded_hal_02::digital::v2::OutputPin; +- use embedded_hal_02::digital::v2::ToggleableOutputPin; ++ use embedded_hal::digital::OutputPin; ++ use embedded_hal::digital::StatefulOutputPin; +``` + +```diff +- use embedded_hal_02::serial::{Read, Write}; ++ use embedded_hal_nb::serial::{Read, Write}; +``` + +You might also want to check the full official `embedded-hal` migration guide: +https://github.com/rust-embedded/embedded-hal/blob/master/docs/migrating-from-0.2-to-1.0.md diff --git a/esp-hal/src/analog/adc/esp32.rs b/esp-hal/src/analog/adc/esp32.rs index 4bacea253..d5d99358f 100644 --- a/esp-hal/src/analog/adc/esp32.rs +++ b/esp-hal/src/analog/adc/esp32.rs @@ -343,19 +343,6 @@ impl<'d, ADC1> Adc<'d, ADC1> { } } -impl<'d, ADCI, PIN> embedded_hal_02::adc::OneShot> - for Adc<'d, ADCI> -where - PIN: embedded_hal_02::adc::Channel + super::AdcChannel, - ADCI: RegisterAccess, -{ - type Error = (); - - fn read(&mut self, pin: &mut super::AdcPin) -> nb::Result { - self.read_oneshot(pin) - } -} - mod adc_implementation { crate::analog::adc::impl_adc_interface! { ADC1 [ diff --git a/esp-hal/src/analog/adc/mod.rs b/esp-hal/src/analog/adc/mod.rs index d34b59c17..e247e82aa 100644 --- a/esp-hal/src/analog/adc/mod.rs +++ b/esp-hal/src/analog/adc/mod.rs @@ -16,10 +16,6 @@ //! basic calibration, curve fitting or linear interpolation. The calibration //! schemes can be used to improve the accuracy of the ADC readings. //! -//! ## Usage -//! -//! The ADC driver implements the `embedded-hal@0.2.x` ADC traits. -//! //! ## Examples //! //! ### Read an analog signal from a pin @@ -108,17 +104,6 @@ pub struct AdcPin { _phantom: PhantomData, } -impl embedded_hal_02::adc::Channel for AdcPin -where - PIN: embedded_hal_02::adc::Channel, -{ - type ID = u8; - - fn channel() -> Self::ID { - PIN::channel() - } -} - /// Configuration for the ADC. pub struct AdcConfig { #[cfg_attr(not(esp32), allow(unused))] @@ -256,12 +241,6 @@ macro_rules! impl_adc_interface { impl $crate::analog::adc::AdcChannel for crate::gpio::GpioPin<$pin> { const CHANNEL: u8 = $channel; } - - impl embedded_hal_02::adc::Channel for crate::gpio::GpioPin<$pin> { - type ID = u8; - - fn channel() -> u8 { $channel } - } )+ } } diff --git a/esp-hal/src/analog/adc/riscv.rs b/esp-hal/src/analog/adc/riscv.rs index c228502e4..9cd593f43 100644 --- a/esp-hal/src/analog/adc/riscv.rs +++ b/esp-hal/src/analog/adc/riscv.rs @@ -531,20 +531,6 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 { } } -impl embedded_hal_02::adc::OneShot> - for Adc<'_, ADCI> -where - PIN: embedded_hal_02::adc::Channel + super::AdcChannel, - ADCI: RegisterAccess, - CS: super::AdcCalScheme, -{ - type Error = (); - - fn read(&mut self, pin: &mut super::AdcPin) -> nb::Result { - self.read_oneshot(pin) - } -} - #[cfg(esp32c2)] mod adc_implementation { crate::analog::adc::impl_adc_interface! { diff --git a/esp-hal/src/analog/adc/xtensa.rs b/esp-hal/src/analog/adc/xtensa.rs index c8f547dce..d7d01d895 100644 --- a/esp-hal/src/analog/adc/xtensa.rs +++ b/esp-hal/src/analog/adc/xtensa.rs @@ -590,20 +590,6 @@ impl super::AdcCalEfuse for crate::peripherals::ADC2 { } } -impl<'d, ADCI, PIN, CS> embedded_hal_02::adc::OneShot> - for Adc<'d, ADCI> -where - PIN: embedded_hal_02::adc::Channel + AdcChannel, - ADCI: RegisterAccess, - CS: AdcCalScheme, -{ - type Error = (); - - fn read(&mut self, pin: &mut AdcPin) -> nb::Result { - self.read_oneshot(pin) - } -} - mod adc_implementation { crate::analog::adc::impl_adc_interface! { ADC1 [ diff --git a/esp-hal/src/delay.rs b/esp-hal/src/delay.rs index d1c562b01..a361aabcc 100644 --- a/esp-hal/src/delay.rs +++ b/esp-hal/src/delay.rs @@ -13,8 +13,7 @@ //! //! ## Usage //! -//! This module implements the blocking [DelayMs] and [DelayUs] traits from -//! [embedded-hal], both 0.2.x and 1.x.x. +//! This module implements the blocking [DelayNs] trait from [embedded-hal]. //! //! ## Examples //! ### Delay for 1 second @@ -28,8 +27,7 @@ //! # } //! ``` //! -//! [DelayMs]: embedded_hal_02::blocking::delay::DelayMs -//! [DelayUs]: embedded_hal_02::blocking::delay::DelayUs +//! [DelayNs]: https://docs.rs/embedded-hal/1.0.0/embedded_hal/delay/trait.DelayNs.html //! [embedded-hal]: https://docs.rs/embedded-hal/1.0.0/embedded_hal/delay/index.html //! [now]: crate::time::now @@ -43,24 +41,6 @@ pub use fugit::MicrosDurationU64; #[non_exhaustive] pub struct Delay; -impl embedded_hal_02::blocking::delay::DelayMs for Delay -where - T: Into, -{ - fn delay_ms(&mut self, ms: T) { - self.delay_millis(ms.into()); - } -} - -impl embedded_hal_02::blocking::delay::DelayUs for Delay -where - T: Into, -{ - fn delay_us(&mut self, us: T) { - self.delay_micros(us.into()); - } -} - impl embedded_hal::delay::DelayNs for Delay { fn delay_ns(&mut self, ns: u32) { self.delay_nanos(ns); diff --git a/esp-hal/src/gpio/mod.rs b/esp-hal/src/gpio/mod.rs index 6b01ef5d5..de6ee6b70 100644 --- a/esp-hal/src/gpio/mod.rs +++ b/esp-hal/src/gpio/mod.rs @@ -31,6 +31,9 @@ //! GPIO interrupts. For more information, see the //! [`Io::set_interrupt_handler`]. //! +//! This driver also implements pin-related traits from [embedded-hal] and +//! [Wait](embedded_hal_async::digital::Wait) trait from [embedded-hal-async]. +//! //! ## GPIO interconnect //! //! Sometimes you may want to connect peripherals together without using @@ -49,6 +52,7 @@ //! See the [Inverting TX and RX Pins] example of the UART documentation. //! //! [embedded-hal]: https://docs.rs/embedded-hal/latest/embedded_hal/ +//! [embedded-hal-async]: https://docs.rs/embedded-hal-async/latest/embedded_hal_async/index.html //! [Inverting TX and RX Pins]: crate::uart#inverting-rx-and-tx-pins use portable_atomic::{AtomicPtr, Ordering}; @@ -2297,175 +2301,6 @@ mod asynch { } } -mod embedded_hal_02_impls { - use embedded_hal_02::digital::v2 as digital; - - use super::*; - - impl

digital::InputPin for Input<'_, P> - where - P: InputPin, - { - type Error = core::convert::Infallible; - - fn is_high(&self) -> Result { - Ok(self.pin.is_high()) - } - fn is_low(&self) -> Result { - Ok(self.pin.is_low()) - } - } - - impl

digital::OutputPin for Output<'_, P> - where - P: OutputPin, - { - type Error = core::convert::Infallible; - - fn set_high(&mut self) -> Result<(), Self::Error> { - self.pin.set_high(); - Ok(()) - } - fn set_low(&mut self) -> Result<(), Self::Error> { - self.pin.set_low(); - Ok(()) - } - } - - impl

digital::StatefulOutputPin for Output<'_, P> - where - P: OutputPin, - { - fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) - } - fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) - } - } - - impl

digital::ToggleableOutputPin for Output<'_, P> - where - P: OutputPin, - { - type Error = core::convert::Infallible; - - fn toggle(&mut self) -> Result<(), Self::Error> { - self.toggle(); - Ok(()) - } - } - - impl

digital::InputPin for OutputOpenDrain<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn is_high(&self) -> Result { - Ok(self.pin.is_high()) - } - fn is_low(&self) -> Result { - Ok(self.pin.is_low()) - } - } - - impl

digital::OutputPin for OutputOpenDrain<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn set_high(&mut self) -> Result<(), Self::Error> { - self.set_high(); - Ok(()) - } - - fn set_low(&mut self) -> Result<(), Self::Error> { - self.set_low(); - Ok(()) - } - } - - impl

digital::StatefulOutputPin for OutputOpenDrain<'_, P> - where - P: InputPin + OutputPin, - { - fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) - } - fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) - } - } - - impl

digital::ToggleableOutputPin for OutputOpenDrain<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn toggle(&mut self) -> Result<(), Self::Error> { - self.toggle(); - Ok(()) - } - } - - impl

digital::InputPin for Flex<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn is_high(&self) -> Result { - Ok(self.is_high()) - } - fn is_low(&self) -> Result { - Ok(self.is_low()) - } - } - - impl

digital::OutputPin for Flex<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn set_high(&mut self) -> Result<(), Self::Error> { - self.pin.set_output_high(true, private::Internal); - Ok(()) - } - fn set_low(&mut self) -> Result<(), Self::Error> { - self.pin.set_output_high(false, private::Internal); - Ok(()) - } - } - - impl

digital::StatefulOutputPin for Flex<'_, P> - where - P: InputPin + OutputPin, - { - fn is_set_high(&self) -> Result { - Ok(self.is_set_high()) - } - fn is_set_low(&self) -> Result { - Ok(self.is_set_low()) - } - } - - impl

digital::ToggleableOutputPin for Flex<'_, P> - where - P: InputPin + OutputPin, - { - type Error = core::convert::Infallible; - - fn toggle(&mut self) -> Result<(), Self::Error> { - self.toggle(); - Ok(()) - } - } -} - mod embedded_hal_impls { use embedded_hal::digital; diff --git a/esp-hal/src/gpio/placeholder.rs b/esp-hal/src/gpio/placeholder.rs index bf269c4d2..8f4b12f2a 100644 --- a/esp-hal/src/gpio/placeholder.rs +++ b/esp-hal/src/gpio/placeholder.rs @@ -85,25 +85,6 @@ impl crate::peripheral::Peripheral for NoPin { impl private::Sealed for NoPin {} -impl embedded_hal_02::digital::v2::OutputPin for NoPin { - type Error = core::convert::Infallible; - - fn set_high(&mut self) -> Result<(), Self::Error> { - Ok(()) - } - fn set_low(&mut self) -> Result<(), Self::Error> { - Ok(()) - } -} -impl embedded_hal_02::digital::v2::StatefulOutputPin for NoPin { - fn is_set_high(&self) -> Result { - Ok(false) - } - fn is_set_low(&self) -> Result { - Ok(false) - } -} - impl embedded_hal::digital::ErrorType for NoPin { type Error = core::convert::Infallible; } diff --git a/esp-hal/src/i2c/master/mod.rs b/esp-hal/src/i2c/master/mod.rs index 67596b699..0bed0dfd9 100644 --- a/esp-hal/src/i2c/master/mod.rs +++ b/esp-hal/src/i2c/master/mod.rs @@ -9,8 +9,7 @@ //! //! The I2C driver implements a number of third-party traits, with the //! intention of making the HAL inter-compatible with various device drivers -//! from the community. This includes the [`embedded-hal`] for both 0.2.x and -//! 1.0.x versions. +//! from the community, including the [`embedded-hal`]. //! //! ## Examples //! @@ -35,7 +34,7 @@ //! } //! # } //! ``` -//! [`embedded-hal`]: https://crates.io/crates/embedded-hal +//! [`embedded-hal`]: https://docs.rs/embedded-hal/latest/embedded_hal/index.html use core::marker::PhantomData; #[cfg(not(esp32))] @@ -285,44 +284,6 @@ impl SetConfig for I2c<'_, DM, T> { } } -impl embedded_hal_02::blocking::i2c::Read for I2c<'_, Blocking, T> -where - T: Instance, -{ - type Error = Error; - - fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { - self.read(address, buffer) - } -} - -impl embedded_hal_02::blocking::i2c::Write for I2c<'_, Blocking, T> -where - T: Instance, -{ - type Error = Error; - - fn write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Self::Error> { - self.write(addr, bytes) - } -} - -impl embedded_hal_02::blocking::i2c::WriteRead for I2c<'_, Blocking, T> -where - T: Instance, -{ - type Error = Error; - - fn write_read( - &mut self, - address: u8, - bytes: &[u8], - buffer: &mut [u8], - ) -> Result<(), Self::Error> { - self.write_read(address, bytes, buffer) - } -} - impl embedded_hal::i2c::ErrorType for I2c<'_, DM, T> { type Error = Error; } diff --git a/esp-hal/src/lib.rs b/esp-hal/src/lib.rs index 0d73e7dcf..553d2d6b5 100644 --- a/esp-hal/src/lib.rs +++ b/esp-hal/src/lib.rs @@ -127,8 +127,8 @@ //! //! [documentation]: https://docs.esp-rs.org/esp-hal //! [examples]: https://github.com/esp-rs/esp-hal/tree/main/examples -//! [embedded-hal]: https://github.com/rust-embedded/embedded-hal/tree/master/embedded-hal -//! [embedded-hal-async]: https://github.com/rust-embedded/embedded-hal/tree/master/embedded-hal-async +//! [embedded-hal]: https://docs.rs/embedded-hal/latest/embedded_hal/ +//! [embedded-hal-async]: https://docs.rs/embedded-hal-async/latest/embedded_hal_async/ //! [xtask]: https://github.com/matklad/cargo-xtask //! [esp-generate]: https://github.com/esp-rs/esp-generate //! [book]: https://docs.esp-rs.org/book/ diff --git a/esp-hal/src/mcpwm/operator.rs b/esp-hal/src/mcpwm/operator.rs index 98441048e..6b814413c 100644 --- a/esp-hal/src/mcpwm/operator.rs +++ b/esp-hal/src/mcpwm/operator.rs @@ -421,39 +421,6 @@ impl<'d, PWM: PwmPeripheral, const OP: u8, const IS_A: bool> PwmPin<'d, PWM, OP, } } -impl embedded_hal_02::PwmPin - for PwmPin<'_, PWM, OP, IS_A> -{ - type Duty = u16; - - /// This only set the timestamp to 0, if you want to disable the PwmPin, - /// it must be done on the timer itself. - fn disable(&mut self) { - self.set_timestamp(0); - } - - /// This only set the timestamp to the maximum, if you want to disable the - /// PwmPin, it must be done on the timer itself. - fn enable(&mut self) { - self.set_timestamp(u16::MAX); - } - - /// Get the duty of the pin - fn get_duty(&self) -> Self::Duty { - self.timestamp() - } - - /// Get the max duty of the pin - fn get_max_duty(&self) -> Self::Duty { - self.period() - } - - /// Set the duty of the pin - fn set_duty(&mut self, duty: Self::Duty) { - self.set_timestamp(duty); - } -} - /// Implement no error type for the PwmPin because the method are infallible impl embedded_hal::pwm::ErrorType for PwmPin<'_, PWM, OP, IS_A> diff --git a/esp-hal/src/rng.rs b/esp-hal/src/rng.rs index 182257a4e..321674463 100644 --- a/esp-hal/src/rng.rs +++ b/esp-hal/src/rng.rs @@ -32,10 +32,7 @@ //! method, which returns a 32-bit unsigned integer. //! //! ## Usage -//! This driver implements the [Read](embedded_hal_02::blocking::rng::Read) -//! trait from the `embedded_hal` crate, allowing you to generate random bytes -//! by calling the `read` method. The driver also implements the traits from the -//! [`rand_core`] crate. +//! The driver implements the traits from the [`rand_core`] crate. //! //! [`rand_core`]: https://crates.io/crates/rand_core //! @@ -139,15 +136,6 @@ impl Rng { } } -impl embedded_hal_02::blocking::rng::Read for Rng { - type Error = core::convert::Infallible; - - fn read(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error> { - self.read(buffer); - Ok(()) - } -} - impl rand_core::RngCore for Rng { fn next_u32(&mut self) -> u32 { self.random() @@ -229,15 +217,6 @@ impl Drop for Trng<'_> { } } -impl embedded_hal_02::blocking::rng::Read for Trng<'_> { - type Error = core::convert::Infallible; - /// Fills the provided buffer with random bytes. - fn read(&mut self, buffer: &mut [u8]) -> Result<(), Self::Error> { - self.rng.read(buffer); - Ok(()) - } -} - /// Implementing RngCore trait from rand_core for `Trng` structure impl rand_core::RngCore for Trng<'_> { fn next_u32(&mut self) -> u32 { diff --git a/esp-hal/src/rtc_cntl/mod.rs b/esp-hal/src/rtc_cntl/mod.rs index 5aaf9370d..be5724fc7 100644 --- a/esp-hal/src/rtc_cntl/mod.rs +++ b/esp-hal/src/rtc_cntl/mod.rs @@ -1095,29 +1095,6 @@ impl Rwdt { } } -impl embedded_hal_02::watchdog::WatchdogDisable for Rwdt { - fn disable(&mut self) { - self.disable(); - } -} - -impl embedded_hal_02::watchdog::WatchdogEnable for Rwdt { - type Time = MicrosDurationU64; - - fn start(&mut self, period: T) - where - T: Into, - { - self.set_timeout(RwdtStage::Stage0, period.into()); - } -} - -impl embedded_hal_02::watchdog::Watchdog for Rwdt { - fn feed(&mut self) { - self.feed(); - } -} - #[cfg(any(esp32c2, esp32c3, esp32c6, esp32h2, esp32s3))] /// Super Watchdog pub struct Swd; @@ -1172,13 +1149,6 @@ impl Default for Swd { } } -#[cfg(any(esp32c2, esp32c3, esp32c6, esp32h2, esp32s3))] -impl embedded_hal_02::watchdog::WatchdogDisable for Swd { - fn disable(&mut self) { - self.disable(); - } -} - /// Return reset reason. pub fn reset_reason(cpu: Cpu) -> Option { let reason = crate::rom::rtc_get_reset_reason(cpu as u32); diff --git a/esp-hal/src/spi/master.rs b/esp-hal/src/spi/master.rs index 82bbb70d5..04894b9bd 100644 --- a/esp-hal/src/spi/master.rs +++ b/esp-hal/src/spi/master.rs @@ -14,8 +14,6 @@ //! If all you want to do is to communicate to a single device, and you initiate //! transactions yourself, there are a number of ways to achieve this: //! -//! - Use the [`FullDuplex`](embedded_hal_02::spi::FullDuplex) trait to -//! read/write single bytes at a time, //! - Use the [`SpiBus`](embedded_hal::spi::SpiBus) trait and its associated //! functions to initiate transactions with simultaneous reads and writes, or //! - Use the `ExclusiveDevice` struct from [`embedded-hal-bus`] or `SpiDevice` @@ -30,8 +28,8 @@ //! //! ## Usage //! -//! The module implements several third-party traits from embedded-hal@0.2.x, -//! embedded-hal@1.x.x and embassy-embedded-hal +//! The module implements several third-party traits from embedded-hal@1.x.x +//! and embassy-embedded-hal. //! //! ## Examples //! @@ -806,44 +804,6 @@ where } } -impl embedded_hal_02::spi::FullDuplex for Spi<'_, M, T> -where - T: Instance, -{ - type Error = Error; - - fn read(&mut self) -> nb::Result { - self.read_byte() - } - - fn send(&mut self, word: u8) -> nb::Result<(), Self::Error> { - self.write_byte(word) - } -} - -impl embedded_hal_02::blocking::spi::Transfer for Spi<'_, M, T> -where - T: Instance, -{ - type Error = Error; - - fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { - self.transfer(words) - } -} - -impl embedded_hal_02::blocking::spi::Write for Spi<'_, M, T> -where - T: Instance, -{ - type Error = Error; - - fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { - self.write_bytes(words)?; - self.driver().flush() - } -} - mod dma { use core::{ cmp::min, @@ -1805,30 +1765,6 @@ mod dma { } } - impl embedded_hal_02::blocking::spi::Transfer for SpiDmaBus<'_, Blocking, T> - where - T: Instance, - { - type Error = Error; - - fn transfer<'w>(&mut self, words: &'w mut [u8]) -> Result<&'w [u8], Self::Error> { - self.transfer_in_place(words)?; - Ok(words) - } - } - - impl embedded_hal_02::blocking::spi::Write for SpiDmaBus<'_, Blocking, T> - where - T: Instance, - { - type Error = Error; - - fn write(&mut self, words: &[u8]) -> Result<(), Self::Error> { - self.write(words)?; - Ok(()) - } - } - /// Async functionality mod asynch { use core::{ @@ -2773,7 +2709,7 @@ impl Info { // Wait for all chunks to complete except the last one. // The function is allowed to return before the bus is idle. - // see [embedded-hal flushing](https://docs.rs/embedded-hal/1.0.0-alpha.8/embedded_hal/spi/blocking/index.html#flushing) + // see [embedded-hal flushing](https://docs.rs/embedded-hal/1.0.0/embedded_hal/spi/index.html#flushing) if i < num_chunks { self.flush()?; } diff --git a/esp-hal/src/timer/mod.rs b/esp-hal/src/timer/mod.rs index a05138a13..47ab42211 100644 --- a/esp-hal/src/timer/mod.rs +++ b/esp-hal/src/timer/mod.rs @@ -211,26 +211,6 @@ where } } -impl embedded_hal_02::blocking::delay::DelayMs for OneShotTimer<'_, T> -where - T: Timer, - UXX: Into, -{ - fn delay_ms(&mut self, ms: UXX) { - self.delay_millis(ms.into()); - } -} - -impl embedded_hal_02::blocking::delay::DelayUs for OneShotTimer<'_, T> -where - T: Timer, - UXX: Into, -{ - fn delay_us(&mut self, us: UXX) { - self.delay_micros(us.into()); - } -} - impl embedded_hal::delay::DelayNs for OneShotTimer<'_, T> where T: Timer, @@ -325,37 +305,6 @@ where } } -impl embedded_hal_02::timer::CountDown for PeriodicTimer<'_, T> -where - T: Timer, -{ - type Time = MicrosDurationU64; - - fn start