diff --git a/Cargo.toml b/Cargo.toml index c50e55f7..2d1de6fa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,8 @@ rustdoc-args = ["--cfg", "docsrs"] [dependencies] fugit = "0.3.5" -embedded-hal = { version = "1.0" } +embedded-hal-02 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] } +embedded-hal-1 = { package = "embedded-hal", version = "1.0" } embedded-dma = "0.2.0" embedded-io = "0.6.1" cortex-m = { version = "^0.7.7", features = ["critical-section-single-core"] } diff --git a/examples/blinky-stm32h747i-disco.rs b/examples/blinky-stm32h747i-disco.rs index d520cf61..38d060f0 100644 --- a/examples/blinky-stm32h747i-disco.rs +++ b/examples/blinky-stm32h747i-disco.rs @@ -6,6 +6,8 @@ use cortex_m_rt::entry; use stm32h7xx_hal::{pac, prelude::*}; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 + use log::info; #[macro_use] @@ -53,13 +55,13 @@ fn main() -> ! { led2.set_low(); led3.set_high(); led4.set_low(); - delay.delay_ms(500_u16); + delay.delay_ms(500); led1.set_low(); led2.set_high(); led3.set_low(); led4.set_high(); - delay.delay_ms(500_u16); + delay.delay_ms(500); } } } diff --git a/examples/blinky.rs b/examples/blinky.rs index 7a2497aa..5a553f00 100644 --- a/examples/blinky.rs +++ b/examples/blinky.rs @@ -8,7 +8,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; use log::info; diff --git a/examples/blinky_random.rs b/examples/blinky_random.rs index c1828473..f51d704e 100644 --- a/examples/blinky_random.rs +++ b/examples/blinky_random.rs @@ -7,7 +7,7 @@ #![no_std] use cortex_m_rt::entry; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; #[macro_use] diff --git a/examples/blinky_timer.rs b/examples/blinky_timer.rs index ac6cf0c2..2635c7c3 100644 --- a/examples/blinky_timer.rs +++ b/examples/blinky_timer.rs @@ -10,7 +10,7 @@ mod utilities; extern crate nb; use cortex_m_rt::entry; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; use log::info; diff --git a/examples/can-echo.rs b/examples/can-echo.rs index a6c56168..5c466fa4 100644 --- a/examples/can-echo.rs +++ b/examples/can-echo.rs @@ -18,7 +18,7 @@ use crate::hal::{ rcc, rcc::rec, }; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use fdcan::{ config::NominalBitTiming, filter::{StandardFilter, StandardFilterSlot}, diff --git a/examples/can-fd.rs b/examples/can-fd.rs index b57a8021..47f11b13 100644 --- a/examples/can-fd.rs +++ b/examples/can-fd.rs @@ -30,7 +30,7 @@ use crate::hal::{ rcc, rcc::rec, }; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use fdcan::{ config::{DataBitTiming, FrameTransmissionConfig, NominalBitTiming}, filter::{StandardFilter, StandardFilterSlot}, diff --git a/examples/display-dsi-command-teartest-stm32h747i-disco.rs b/examples/display-dsi-command-teartest-stm32h747i-disco.rs index e14907da..5e60d8b0 100644 --- a/examples/display-dsi-command-teartest-stm32h747i-disco.rs +++ b/examples/display-dsi-command-teartest-stm32h747i-disco.rs @@ -27,6 +27,8 @@ use log::info; use otm8009a::Otm8009AConfig; use stm32h7xx_hal::dsi::{ColorCoding, DsiChannel, DsiConfig, DsiPllConfig}; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 + extern crate cortex_m; extern crate cortex_m_rt as rt; use cortex_m_rt::{entry, exception}; diff --git a/examples/display-dsi-video-stm32h747i-disco.rs b/examples/display-dsi-video-stm32h747i-disco.rs index e27fc9b4..cc4ede07 100644 --- a/examples/display-dsi-video-stm32h747i-disco.rs +++ b/examples/display-dsi-video-stm32h747i-disco.rs @@ -22,6 +22,8 @@ use log::info; use otm8009a::Otm8009AConfig; use stm32h7xx_hal::dsi::{ColorCoding, DsiChannel, DsiConfig, DsiPllConfig}; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 + extern crate cortex_m; extern crate cortex_m_rt as rt; use cortex_m_rt::{entry, exception}; diff --git a/examples/display-dsi-video-teartest-stm32h747i-disco.rs b/examples/display-dsi-video-teartest-stm32h747i-disco.rs index 4b95ac8c..d020ecbf 100644 --- a/examples/display-dsi-video-teartest-stm32h747i-disco.rs +++ b/examples/display-dsi-video-teartest-stm32h747i-disco.rs @@ -30,6 +30,8 @@ extern crate cortex_m; extern crate cortex_m_rt as rt; use cortex_m_rt::{entry, exception}; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 + use crate::utilities_display::display_target::BufferedDisplay; use stm32h7xx_hal::gpio::Speed; use stm32h7xx_hal::ltdc; diff --git a/examples/embedded-graphics.rs b/examples/embedded-graphics.rs index 41659af3..ff9e97d4 100644 --- a/examples/embedded-graphics.rs +++ b/examples/embedded-graphics.rs @@ -21,7 +21,7 @@ extern crate cortex_m_rt as rt; use core::sync::atomic::{AtomicU32, Ordering}; use cortex_m_rt::{entry, exception}; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::gpio::Speed; use stm32h7xx_hal::rcc::CoreClocks; use stm32h7xx_hal::{ltdc, xspi}; diff --git a/examples/gpio_with_input.rs b/examples/gpio_with_input.rs index 994dd7ed..0492bb05 100644 --- a/examples/gpio_with_input.rs +++ b/examples/gpio_with_input.rs @@ -7,7 +7,7 @@ #![no_std] use cortex_m_rt::entry; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; use log::info; diff --git a/examples/i2c.rs b/examples/i2c.rs index 43612afd..3e3f0e4b 100644 --- a/examples/i2c.rs +++ b/examples/i2c.rs @@ -5,7 +5,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::i2c::*; +use embedded_hal_1::i2c::*; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; use log::info; diff --git a/examples/i2c4_bdma.rs b/examples/i2c4_bdma.rs index 1b500410..76e41686 100644 --- a/examples/i2c4_bdma.rs +++ b/examples/i2c4_bdma.rs @@ -12,7 +12,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::i2c::*; +use embedded_hal_1::i2c::*; // this example uses embedded-hal v1.0 use stm32h7xx_hal::dma::{ bdma::{BdmaConfig, StreamsTuple}, PeripheralToMemory, Transfer, diff --git a/examples/pwm.rs b/examples/pwm.rs index ab310938..f127aaa6 100644 --- a/examples/pwm.rs +++ b/examples/pwm.rs @@ -5,7 +5,7 @@ use cortex_m::asm; use cortex_m_rt::entry; -use embedded_hal::pwm::*; +use embedded_hal_1::pwm::*; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*}; #[macro_use] diff --git a/examples/pwm_advanced.rs b/examples/pwm_advanced.rs index 7ef2efb2..26550b2c 100644 --- a/examples/pwm_advanced.rs +++ b/examples/pwm_advanced.rs @@ -55,7 +55,7 @@ mod utilities; use stm32h7xx_hal::pwm::{FaultMonitor, Polarity}; use stm32h7xx_hal::{pac, prelude::*}; -use embedded_hal::pwm::*; +use embedded_hal_1::pwm::*; // this example uses embedded-hal v1.0 use log::info; diff --git a/examples/pwm_lptim.rs b/examples/pwm_lptim.rs index d22160c9..19513cf0 100644 --- a/examples/pwm_lptim.rs +++ b/examples/pwm_lptim.rs @@ -9,7 +9,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::pwm::*; +use embedded_hal_1::pwm::*; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*, rcc::rec}; use log::info; diff --git a/examples/reset_reason.rs b/examples/reset_reason.rs index d28a4b97..32115d75 100644 --- a/examples/reset_reason.rs +++ b/examples/reset_reason.rs @@ -9,7 +9,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*, rcc::ResetReason}; use log::info; diff --git a/examples/sdmmc.rs b/examples/sdmmc.rs index f898e70c..fde9f292 100644 --- a/examples/sdmmc.rs +++ b/examples/sdmmc.rs @@ -11,7 +11,7 @@ mod utilities; use cortex_m_rt::entry; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::gpio::Speed; use stm32h7xx_hal::sdmmc::{SdCard, Sdmmc}; use stm32h7xx_hal::{pac, prelude::*}; diff --git a/examples/sdmmc_fat.rs b/examples/sdmmc_fat.rs index 89e02e75..9dc5a76a 100644 --- a/examples/sdmmc_fat.rs +++ b/examples/sdmmc_fat.rs @@ -2,7 +2,7 @@ #![no_std] use { - embedded_hal::delay::DelayNs, + embedded_hal_1::delay::DelayNs, // this example uses embedded-hal v1.0 // this example uses embedded-hal v1.0 embedded_sdmmc::{Controller, Mode, VolumeIdx}, stm32h7xx_hal::sdmmc::{SdCard, Sdmmc}, stm32h7xx_hal::{pac, prelude::*, rcc}, diff --git a/examples/spi.rs b/examples/spi.rs index feb56c43..f4fe99d9 100644 --- a/examples/spi.rs +++ b/examples/spi.rs @@ -6,7 +6,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::spi::*; +use embedded_hal_1::spi::*; // this example uses embedded-hal v1.0 use nb::block; use stm32h7xx_hal::{pac, prelude::*, spi}; diff --git a/examples/spi_hardware_cs.rs b/examples/spi_hardware_cs.rs index 6a6da6f5..0fcec790 100644 --- a/examples/spi_hardware_cs.rs +++ b/examples/spi_hardware_cs.rs @@ -17,7 +17,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::spi::*; +use embedded_hal_1::spi::*; // this example uses embedded-hal v1.0 use nb::block; use stm32h7xx_hal::{pac, prelude::*, spi}; diff --git a/examples/spi_send_frames.rs b/examples/spi_send_frames.rs index c2dbc1f5..67517f2b 100644 --- a/examples/spi_send_frames.rs +++ b/examples/spi_send_frames.rs @@ -12,7 +12,7 @@ use cortex_m_rt::entry; mod utilities; use core::num::NonZeroU16; -use embedded_hal::spi::*; +use embedded_hal_1::spi::*; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{pac, prelude::*, spi}; use log::info; diff --git a/examples/temperature.rs b/examples/temperature.rs index 1245f434..76acfe72 100644 --- a/examples/temperature.rs +++ b/examples/temperature.rs @@ -11,7 +11,7 @@ use cortex_m_rt::entry; #[macro_use] mod utilities; -use embedded_hal::delay::DelayNs; +use embedded_hal_1::delay::DelayNs; // this example uses embedded-hal v1.0 use stm32h7xx_hal::{ adc, delay::Delay, diff --git a/examples/usb_phy_serial_interrupt.rs b/examples/usb_phy_serial_interrupt.rs index bf14f836..cad06ea3 100644 --- a/examples/usb_phy_serial_interrupt.rs +++ b/examples/usb_phy_serial_interrupt.rs @@ -11,7 +11,7 @@ use { core::cell::RefCell, core::mem::MaybeUninit, cortex_m::interrupt::{free as interrupt_free, Mutex}, - embedded_hal::delay::DelayNs, + embedded_hal_1::delay::DelayNs, // this example uses embedded-hal v1.0 stm32h7xx_hal::{ interrupt, pac, prelude::*, diff --git a/src/delay.rs b/src/delay.rs index 5b04ec2b..2f7cb067 100644 --- a/src/delay.rs +++ b/src/delay.rs @@ -39,7 +39,6 @@ use cortex_m::peripheral::syst::SystClkSource; use cortex_m::peripheral::SYST; -use embedded_hal::delay::DelayNs; use void::Void; use crate::block; @@ -206,7 +205,7 @@ impl Delay { } } -impl DelayNs for Delay { +impl embedded_hal_1::delay::DelayNs for Delay { fn delay_ns(&mut self, ns: u32) { // With c_ck up to 480e6, 1 cycle is always > 2ns @@ -310,7 +309,7 @@ macro_rules! impl_delay_from_count_down_timer { } } - impl DelayNs for DelayFromCountDownTimer<$TIMX> { + impl embedded_hal_1::delay::DelayNs for DelayFromCountDownTimer<$TIMX> { fn delay_ns(&mut self, ns: u32) { // TODO(): This delay is 1000x longer than the intended duration! self.delay_us_internal(ns); diff --git a/src/gpio.rs b/src/gpio.rs index e4d18db2..f2b404ab 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -78,7 +78,7 @@ pub use dynamic::{Dynamic, DynamicPin}; mod hal_02; mod hal_1; -pub use embedded_hal::digital::PinState; +pub use embedded_hal_1::digital::PinState; use core::fmt; diff --git a/src/gpio/hal_1.rs b/src/gpio/hal_1.rs index 56315e50..6132c8f5 100644 --- a/src/gpio/hal_1.rs +++ b/src/gpio/hal_1.rs @@ -3,8 +3,8 @@ use super::{ PartiallyErasedPin, Pin, }; -use embedded_hal::digital::{ErrorKind, ErrorType}; -use embedded_hal::digital::{InputPin, OutputPin, StatefulOutputPin}; +use embedded_hal_1::digital::{ErrorKind, ErrorType}; +use embedded_hal_1::digital::{InputPin, OutputPin, StatefulOutputPin}; /// Error type for GPIO #[derive(Clone, Copy, Debug, PartialEq)] @@ -15,7 +15,7 @@ pub enum GpioError { /// Error Other, } -impl embedded_hal::digital::Error for GpioError { +impl embedded_hal_1::digital::Error for GpioError { fn kind(&self) -> ErrorKind { ErrorKind::Other } diff --git a/src/lib.rs b/src/lib.rs index 299a33db..17b83946 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -81,7 +81,7 @@ compile_error!( " ); -pub use embedded_hal as hal; +pub use embedded_hal_1 as hal; pub mod traits; pub use nb;