diff --git a/CHANGELOG.md b/CHANGELOG.md index bca2daeb8..20e35ac9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - shorten gpio ptr access - bump embedded-hal to `1.0` (no more RC!) +- make `embedded-hal` `1.0` main implementation ## [v0.19.0] - 2023-12-11 diff --git a/Cargo.toml b/Cargo.toml index 8d6489a44..dde7c76de 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,8 +39,6 @@ sdio-host = { version = "0.6.0", optional = true } embedded-dma = "0.2.0" bare-metal = { version = "1" } void = { default-features = false, version = "1.0.2" } -embedded-hal = { features = ["unproven"], version = "0.2.7" } -embedded-hal-nb = "1.0" display-interface = { version = "0.4.1", optional = true } fugit = "0.3.7" fugit-timer = "0.1.3" @@ -54,9 +52,16 @@ vcell = "0.1.3" version = "0.3.14" default-features = false -[dependencies.embedded-hal-one] -version = "1.0" +[dependencies.embedded-hal-02] package = "embedded-hal" +version = "0.2.7" +features = ["unproven"] + +[dependencies.embedded-hal] +version = "1.0" + +[dependencies.embedded-hal-nb] +version = "1.0" [dependencies.stm32_i2s_v12x] version = "0.5.0" diff --git a/examples/analog-stopwatch-with-spi-ssd1306.rs b/examples/analog-stopwatch-with-spi-ssd1306.rs index 58f18b643..5e7ec9033 100644 --- a/examples/analog-stopwatch-with-spi-ssd1306.rs +++ b/examples/analog-stopwatch-with-spi-ssd1306.rs @@ -113,7 +113,7 @@ fn main() -> ! { let mut delay = Timer::syst(cp.SYST, &clocks).delay(); ss.set_high(); - delay.delay_ms(100_u32); + delay.delay_ms(100); ss.set_low(); // Set up the display @@ -201,7 +201,7 @@ fn main() -> ! { disp.flush().unwrap(); - delay.delay_ms(100u32); + delay.delay_ms(100); } } diff --git a/examples/delay-syst-blinky.rs b/examples/delay-syst-blinky.rs index 2fee09653..c3a058698 100644 --- a/examples/delay-syst-blinky.rs +++ b/examples/delay-syst-blinky.rs @@ -33,7 +33,7 @@ fn main() -> ! { loop { // On for 1s, off for 1s. led.toggle(); - delay.delay_ms(1000_u32); + delay.delay_ms(1000); } } diff --git a/examples/delay-timer-blinky.rs b/examples/delay-timer-blinky.rs index 80792b542..6f0f73b8e 100644 --- a/examples/delay-timer-blinky.rs +++ b/examples/delay-timer-blinky.rs @@ -33,8 +33,8 @@ fn main() -> ! { loop { // On for 1s, off for 3s. led.set_high(); - // Use `embedded_hal::DelayMs` trait - delay.delay_ms(1000_u32); + // Use `embedded_hal_02::DelayMs` trait + delay.delay_ms(1000); led.set_low(); // or use `fugit::ExtU32` trait delay.delay(3.secs()); diff --git a/examples/dwt-blinky.rs b/examples/dwt-blinky.rs index ede839158..fed1f18c7 100644 --- a/examples/dwt-blinky.rs +++ b/examples/dwt-blinky.rs @@ -40,13 +40,13 @@ fn main() -> ! { // On for 1s, off for 1s. led1.set_high(); led2.set_low(); - delay.delay_ms(1000_u32); + delay.delay_ms(1000); sw.lap(); led1.set_low(); led2.set_high(); - delay.delay_ms(900_u32); + delay.delay_ms(900); // Also you can measure with almost clock precision - let cd: ClockDuration = dwt.measure(|| delay.delay_ms(100_u32)); + let cd: ClockDuration = dwt.measure(|| delay.delay_ms(100)); let _t: u32 = cd.as_ticks(); // Should return 48MHz * 0.1s as u32 let _t: f32 = cd.as_secs_f32(); // Should return ~0.1s as a f32 let _t: f64 = cd.as_secs_f64(); // Should return ~0.1s as a f64 diff --git a/examples/ist7920-bidi-normal-spi.rs b/examples/ist7920-bidi-normal-spi.rs index f4c5c50ca..65277b188 100644 --- a/examples/ist7920-bidi-normal-spi.rs +++ b/examples/ist7920-bidi-normal-spi.rs @@ -57,7 +57,7 @@ fn main() -> ! { let mut select_figure = 0; loop { - delay.delay_ms(500_u16); + delay.delay_ms(500); let (begin, end) = match select_figure { 0 => { select_figure = 1; diff --git a/examples/qei.rs b/examples/qei.rs index 0ba3a5d48..e3b25ce68 100644 --- a/examples/qei.rs +++ b/examples/qei.rs @@ -13,7 +13,7 @@ use panic_halt as _; use cortex_m_rt::entry; -use embedded_hal::Direction as RotaryDirection; +use embedded_hal_02::Direction as RotaryDirection; use stm32f4xx_hal::{pac, prelude::*, qei::Qei}; #[entry] @@ -58,6 +58,6 @@ fn main() -> ! { current_count = new_count; } - delay.delay_ms(10_u32); + delay.delay_ms(10); } } diff --git a/examples/rng-display.rs b/examples/rng-display.rs index 96860b9e8..0829455a9 100644 --- a/examples/rng-display.rs +++ b/examples/rng-display.rs @@ -105,7 +105,7 @@ fn main() -> ! { } disp.flush().unwrap(); //delay a little while between refreshes so the display is readable - delay_source.delay_ms(100u8); + delay_source.delay_ms(100); } } diff --git a/examples/rtic-spi-slave-dma.rs b/examples/rtic-spi-slave-dma.rs index 2cc61cb8c..ecfdc77db 100644 --- a/examples/rtic-spi-slave-dma.rs +++ b/examples/rtic-spi-slave-dma.rs @@ -6,7 +6,7 @@ #[rtic::app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [TIM2])] mod app { - use embedded_hal::spi::{Mode, Phase, Polarity}; + use embedded_hal_02::spi::{Mode, Phase, Polarity}; use hal::{ dma::{ config::DmaConfig, DmaFlag, MemoryToPeripheral, PeripheralToMemory, Stream0, Stream5, diff --git a/examples/sd.rs b/examples/sd.rs index 394df3f79..5312c83bd 100644 --- a/examples/sd.rs +++ b/examples/sd.rs @@ -51,7 +51,7 @@ fn main() -> ! { Err(_err) => (), } - delay.delay_ms(1000u32); + delay.delay_ms(1000); } let nblocks = sdio.card().map(|c| c.block_count()).unwrap_or(0); diff --git a/examples/serial-9bit.rs b/examples/serial-9bit.rs index aaedeb22c..9e6721a3d 100644 --- a/examples/serial-9bit.rs +++ b/examples/serial-9bit.rs @@ -105,7 +105,7 @@ fn main() -> ! { led_bit8.set_low(); } - delay.delay_ms(10u32); + delay.delay_ms(10); } } } diff --git a/examples/spi-dma.rs b/examples/spi-dma.rs index 24309eab7..1a0dfd033 100644 --- a/examples/spi-dma.rs +++ b/examples/spi-dma.rs @@ -8,7 +8,7 @@ use stm32f4xx_hal::dma::DmaFlag; use core::cell::RefCell; use cortex_m::interrupt::Mutex; use cortex_m_rt::entry; -use embedded_hal::spi::{Mode, Phase, Polarity}; +use embedded_hal_02::spi::{Mode, Phase, Polarity}; use stm32f4xx_hal::pac::interrupt; use stm32f4xx_hal::{ dma::{config, MemoryToPeripheral, Stream4, StreamsTuple, Transfer}, diff --git a/examples/st7789-lcd.rs b/examples/st7789-lcd.rs index 783364ab2..4c3380f22 100644 --- a/examples/st7789-lcd.rs +++ b/examples/st7789-lcd.rs @@ -124,7 +124,7 @@ fn main() -> ! { let mut drawer = ColoredCircleDrawer::new(¢er_points, &test_colors); loop { drawer.draw(&mut lcd).unwrap(); - delay.delay_ms(100u16); + delay.delay_ms(100); } } diff --git a/examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs b/examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs index 903ae1caf..620a7d421 100644 --- a/examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs +++ b/examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs @@ -254,7 +254,7 @@ fn main() -> ! { disp.flush().unwrap(); - delay.delay_ms(100u32); + delay.delay_ms(100); } } diff --git a/examples/stopwatch-with-ssd1306-and-interrupts.rs b/examples/stopwatch-with-ssd1306-and-interrupts.rs index 253eabb2e..fd5659fa2 100644 --- a/examples/stopwatch-with-ssd1306-and-interrupts.rs +++ b/examples/stopwatch-with-ssd1306-and-interrupts.rs @@ -137,7 +137,7 @@ fn main() -> ! { disp.flush().unwrap(); - delay.delay_ms(100u32); + delay.delay_ms(100); } } diff --git a/src/adc.rs b/src/adc.rs index fcb3aa30d..b41a32d2c 100644 --- a/src/adc.rs +++ b/src/adc.rs @@ -860,7 +860,7 @@ macro_rules! adc { /// to sample for at a given ADC clock frequency pub fn configure_channel(&mut self, _channel: &CHANNEL, sequence: config::Sequence, sample_time: config::SampleTime) where - CHANNEL: embedded_hal::adc::Channel + CHANNEL: embedded_hal_02::adc::Channel { //Check the sequence is long enough self.adc_reg.sqr1.modify(|r, w| { @@ -953,7 +953,7 @@ macro_rules! adc { /// Note that it reconfigures the adc sequence and doesn't restore it pub fn convert(&mut self, pin: &PIN, sample_time: config::SampleTime) -> u16 where - PIN: embedded_hal::adc::Channel + PIN: embedded_hal_02::adc::Channel { self.adc_reg.cr2.modify(|_, w| w .dma().clear_bit() //Disable dma @@ -986,7 +986,7 @@ macro_rules! adc { impl Adc { fn read(&mut self, pin: &mut PIN) -> nb::Result - where PIN: embedded_hal::adc::Channel, + where PIN: embedded_hal_02::adc::Channel, { let enabled = self.is_enabled(); if !enabled { @@ -1003,9 +1003,9 @@ macro_rules! adc { } } - impl embedded_hal::adc::OneShot for Adc + impl embedded_hal_02::adc::OneShot for Adc where - PIN: embedded_hal::adc::Channel, + PIN: embedded_hal_02::adc::Channel, { type Error = (); diff --git a/src/adc/f4.rs b/src/adc/f4.rs index 61ea1f5a0..3016e66cd 100644 --- a/src/adc/f4.rs +++ b/src/adc/f4.rs @@ -3,7 +3,7 @@ use super::*; macro_rules! adc_pins { ($($pin:ty => ($adc:ident, $chan:expr)),+ $(,)*) => { $( - impl embedded_hal::adc::Channel for $pin { + impl embedded_hal_02::adc::Channel for $pin { type ID = u8; fn channel() -> u8 { $chan } } diff --git a/src/dwt.rs b/src/dwt.rs index 45bad835e..fdd19e1db 100644 --- a/src/dwt.rs +++ b/src/dwt.rs @@ -97,7 +97,7 @@ impl Delay { } // Implement DelayUs/DelayMs for various integer types -impl> embedded_hal::blocking::delay::DelayUs for Delay { +impl> embedded_hal_02::blocking::delay::DelayUs for Delay { fn delay_us(&mut self, us: T) { // Convert us to ticks let start = DWT::cycle_count(); @@ -105,7 +105,7 @@ impl> embedded_hal::blocking::delay::DelayUs for Delay { Delay::delay_ticks(start, ticks); } } -impl> embedded_hal::blocking::delay::DelayMs for Delay { +impl> embedded_hal_02::blocking::delay::DelayMs for Delay { fn delay_ms(&mut self, ms: T) { // Convert ms to ticks let start = DWT::cycle_count(); @@ -114,7 +114,7 @@ impl> embedded_hal::blocking::delay::DelayMs for Delay { } } -impl embedded_hal_one::delay::DelayNs for Delay { +impl embedded_hal::delay::DelayNs for Delay { fn delay_ns(&mut self, ns: u32) { // Convert us to ticks let start = DWT::cycle_count(); diff --git a/src/fmpi2c/hal_02.rs b/src/fmpi2c/hal_02.rs index cf79f52dd..465201f0a 100644 --- a/src/fmpi2c/hal_02.rs +++ b/src/fmpi2c/hal_02.rs @@ -1,7 +1,7 @@ mod blocking { use super::super::{fmpi2c1, Error, FMPI2c, Instance}; use core::ops::Deref; - use embedded_hal::blocking::i2c::{Read, Write, WriteRead}; + use embedded_hal_02::blocking::i2c::{Read, Write, WriteRead}; impl WriteRead for FMPI2c where diff --git a/src/fmpi2c/hal_1.rs b/src/fmpi2c/hal_1.rs index 0f217194b..34a48ee42 100644 --- a/src/fmpi2c/hal_1.rs +++ b/src/fmpi2c/hal_1.rs @@ -1,4 +1,4 @@ -use embedded_hal_one::i2c::ErrorType; +use embedded_hal::i2c::ErrorType; use super::Instance; @@ -9,9 +9,9 @@ impl ErrorType for super::FMPI2c { mod blocking { use super::super::{fmpi2c1, FMPI2c, Instance}; use core::ops::Deref; - use embedded_hal_one::i2c::Operation; + use embedded_hal::i2c::Operation; - impl embedded_hal_one::i2c::I2c for FMPI2c + impl embedded_hal::i2c::I2c for FMPI2c where I2C: Deref, { diff --git a/src/gpio.rs b/src/gpio.rs index 7de1655f5..c5664f0d5 100644 --- a/src/gpio.rs +++ b/src/gpio.rs @@ -71,7 +71,7 @@ mod hal_02; mod hal_1; pub mod outport; -pub use embedded_hal::digital::v2::PinState; +pub use embedded_hal_02::digital::v2::PinState; use core::fmt; diff --git a/src/gpio/dynamic.rs b/src/gpio/dynamic.rs index 3733324c4..fbd331779 100644 --- a/src/gpio/dynamic.rs +++ b/src/gpio/dynamic.rs @@ -1,5 +1,5 @@ use super::*; -use embedded_hal_one::digital::ErrorKind; +use embedded_hal::digital::ErrorKind; /// Pin type with dynamic mode /// @@ -31,7 +31,7 @@ pub enum PinModeError { IncorrectMode, } -impl embedded_hal_one::digital::Error for PinModeError { +impl embedded_hal::digital::Error for PinModeError { fn kind(&self) -> ErrorKind { ErrorKind::Other } diff --git a/src/gpio/hal_02.rs b/src/gpio/hal_02.rs index 9b98be7dc..d3254ab35 100644 --- a/src/gpio/hal_02.rs +++ b/src/gpio/hal_02.rs @@ -5,7 +5,7 @@ use super::{ PartiallyErasedPin, Pin, PinMode, PinState, }; -use embedded_hal::digital::v2::{ +use embedded_hal_02::digital::v2::{ InputPin, IoPin, OutputPin, StatefulOutputPin, ToggleableOutputPin, }; diff --git a/src/gpio/hal_1.rs b/src/gpio/hal_1.rs index 73c12d5de..11db87cb2 100644 --- a/src/gpio/hal_1.rs +++ b/src/gpio/hal_1.rs @@ -4,7 +4,7 @@ use super::{ dynamic::PinModeError, marker, DynamicPin, ErasedPin, Output, PartiallyErasedPin, Pin, }; -use embedded_hal_one::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin}; +use embedded_hal::digital::{ErrorType, InputPin, OutputPin, StatefulOutputPin}; // Implementations for `Pin` impl ErrorType for Pin { @@ -28,12 +28,12 @@ impl OutputPin for Pin> { impl StatefulOutputPin for Pin> { #[inline(always)] fn is_set_high(&mut self) -> Result { - Ok(Pin::is_set_high(self)) + Ok(Self::is_set_high(self)) } #[inline(always)] fn is_set_low(&mut self) -> Result { - Ok(Pin::is_set_low(self)) + Ok(Self::is_set_low(self)) } } @@ -43,12 +43,12 @@ where { #[inline(always)] fn is_high(&mut self) -> Result { - Ok(Pin::is_high(self)) + Ok(Self::is_high(self)) } #[inline(always)] fn is_low(&mut self) -> Result { - Ok(Pin::is_low(self)) + Ok(Self::is_low(self)) } } @@ -74,12 +74,12 @@ impl OutputPin for ErasedPin> { impl StatefulOutputPin for ErasedPin> { #[inline(always)] fn is_set_high(&mut self) -> Result { - Ok(ErasedPin::is_set_high(self)) + Ok(Self::is_set_high(self)) } #[inline(always)] fn is_set_low(&mut self) -> Result { - Ok(ErasedPin::is_set_low(self)) + Ok(Self::is_set_low(self)) } } @@ -89,12 +89,12 @@ where { #[inline(always)] fn is_high(&mut self) -> Result { - Ok(ErasedPin::is_high(self)) + Ok(Self::is_high(self)) } #[inline(always)] fn is_low(&mut self) -> Result { - Ok(ErasedPin::is_low(self)) + Ok(Self::is_low(self)) } } @@ -120,12 +120,12 @@ impl OutputPin for PartiallyErasedPin> { impl StatefulOutputPin for PartiallyErasedPin> { #[inline(always)] fn is_set_high(&mut self) -> Result { - Ok(PartiallyErasedPin::is_set_high(self)) + Ok(Self::is_set_high(self)) } #[inline(always)] fn is_set_low(&mut self) -> Result { - Ok(PartiallyErasedPin::is_set_low(self)) + Ok(Self::is_set_low(self)) } } @@ -135,12 +135,12 @@ where { #[inline(always)] fn is_high(&mut self) -> Result { - Ok(PartiallyErasedPin::is_high(self)) + Ok(Self::is_high(self)) } #[inline(always)] fn is_low(&mut self) -> Result { - Ok(PartiallyErasedPin::is_low(self)) + Ok(Self::is_low(self)) } } @@ -160,9 +160,9 @@ impl OutputPin for DynamicPin { impl InputPin for DynamicPin { fn is_high(&mut self) -> Result { - DynamicPin::is_high(self) + Self::is_high(self) } fn is_low(&mut self) -> Result { - DynamicPin::is_low(self) + Self::is_low(self) } } diff --git a/src/i2c.rs b/src/i2c.rs index 6892c72bd..01809d6aa 100644 --- a/src/i2c.rs +++ b/src/i2c.rs @@ -70,7 +70,7 @@ pub struct I2c { pins: (I2C::Scl, I2C::Sda), } -pub use embedded_hal_one::i2c::NoAcknowledgeSource; +pub use embedded_hal::i2c::NoAcknowledgeSource; #[derive(Debug, Eq, PartialEq, Copy, Clone)] #[non_exhaustive] @@ -605,5 +605,5 @@ macro_rules! transaction_impl { } use transaction_impl; -type Hal1Operation<'a> = embedded_hal_one::i2c::Operation<'a>; -type Hal02Operation<'a> = embedded_hal::blocking::i2c::Operation<'a>; +type Hal1Operation<'a> = embedded_hal::i2c::Operation<'a>; +type Hal02Operation<'a> = embedded_hal_02::blocking::i2c::Operation<'a>; diff --git a/src/i2c/hal_02.rs b/src/i2c/hal_02.rs index 4cc9179f1..e85bb30ca 100644 --- a/src/i2c/hal_02.rs +++ b/src/i2c/hal_02.rs @@ -1,6 +1,6 @@ mod blocking { use super::super::{Error, I2c, Instance}; - use embedded_hal::blocking::i2c::{ + use embedded_hal_02::blocking::i2c::{ Operation, Read, Transactional, Write, WriteIter, WriteIterRead, WriteRead, }; diff --git a/src/i2c/hal_1.rs b/src/i2c/hal_1.rs index 2142358e6..ac0d14a70 100644 --- a/src/i2c/hal_1.rs +++ b/src/i2c/hal_1.rs @@ -1,4 +1,4 @@ -use embedded_hal_one::i2c::{Error, ErrorKind, ErrorType}; +use embedded_hal::i2c::{Error, ErrorKind, ErrorType}; impl Error for super::Error { fn kind(&self) -> ErrorKind { @@ -18,9 +18,9 @@ impl ErrorType for super::I2c { mod blocking { use super::super::{I2c, Instance}; - use embedded_hal_one::i2c::Operation; + use embedded_hal::i2c::Operation; - impl embedded_hal_one::i2c::I2c for I2c { + impl embedded_hal::i2c::I2c for I2c { fn read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<(), Self::Error> { self.read(addr, buffer) } diff --git a/src/lib.rs b/src/lib.rs index f82951ed5..16c31cf72 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,7 +26,7 @@ compile_error!( ); #[cfg(feature = "device-selected")] -pub use embedded_hal as hal; +pub use embedded_hal_02 as hal; #[cfg(feature = "device-selected")] pub use nb; diff --git a/src/prelude.rs b/src/prelude.rs index 8f63a19f3..54422dc25 100644 --- a/src/prelude.rs +++ b/src/prelude.rs @@ -36,15 +36,14 @@ //! ``` //! use stm32f4xx_hal::prelude::*; //! ``` -pub use embedded_hal::adc::OneShot as _embedded_hal_adc_OneShot; -pub use embedded_hal::blocking::delay::DelayMs as _embedded_hal_blocking_delay_DelayMs; -pub use embedded_hal::blocking::delay::DelayUs as _embedded_hal_blocking_delay_DelayUs; -pub use embedded_hal::blocking::serial::Write as _embedded_hal_blocking_serial_Write; -pub use embedded_hal::serial::Read as _embedded_hal_serial_Read; -pub use embedded_hal::serial::Write as _embedded_hal_serial_Write; -pub use embedded_hal::Capture as _embedded_hal_Capture; -pub use embedded_hal::Pwm as _embedded_hal_Pwm; -pub use embedded_hal::Qei as _embedded_hal_Qei; +pub use embedded_hal::delay::DelayNs as _; +pub use embedded_hal_02::adc::OneShot as _embedded_hal_adc_OneShot; +pub use embedded_hal_02::blocking::serial::Write as _embedded_hal_blocking_serial_Write; +pub use embedded_hal_02::serial::Read as _embedded_hal_serial_Read; +pub use embedded_hal_02::serial::Write as _embedded_hal_serial_Write; +pub use embedded_hal_02::Capture as _embedded_hal_Capture; +pub use embedded_hal_02::Pwm as _embedded_hal_Pwm; +pub use embedded_hal_02::Qei as _embedded_hal_Qei; pub use fugit::ExtU32 as _fugit_ExtU32; pub use fugit::RateExtU32 as _fugit_RateExtU32; diff --git a/src/qei.rs b/src/qei.rs index fa8814722..a1f734f7f 100644 --- a/src/qei.rs +++ b/src/qei.rs @@ -78,18 +78,18 @@ impl Qei { } } -impl embedded_hal::Qei for Qei { +impl embedded_hal_02::Qei for Qei { type Count = TIM::Width; fn count(&self) -> Self::Count { self.tim.read_count() } - fn direction(&self) -> embedded_hal::Direction { + fn direction(&self) -> embedded_hal_02::Direction { if self.tim.read_direction() { - embedded_hal::Direction::Upcounting + embedded_hal_02::Direction::Upcounting } else { - embedded_hal::Direction::Downcounting + embedded_hal_02::Direction::Downcounting } } } diff --git a/src/rng.rs b/src/rng.rs index aab7897c8..dafc1d2e0 100644 --- a/src/rng.rs +++ b/src/rng.rs @@ -27,7 +27,7 @@ use crate::pac::RNG; use crate::rcc::{Clocks, Enable, Reset}; use core::num::NonZeroU32; use core::ops::Shl; -use embedded_hal::blocking::rng; +use embedded_hal_02::blocking::rng; use fugit::RateExtU32; use rand_core::RngCore; diff --git a/src/serial/hal_02.rs b/src/serial/hal_02.rs index e566ed2fb..0d0ca8d4d 100644 --- a/src/serial/hal_02.rs +++ b/src/serial/hal_02.rs @@ -2,7 +2,7 @@ mod nb { use core::ops::Deref; use super::super::{Error, Instance, RegisterBlockImpl, Rx, Serial, Tx}; - use embedded_hal::serial::{Read, Write}; + use embedded_hal_02::serial::{Read, Write}; impl Read for Serial where @@ -98,7 +98,7 @@ mod blocking { use core::ops::Deref; use super::super::{Error, Instance, RegisterBlockImpl, Serial, Tx}; - use embedded_hal::blocking::serial::Write; + use embedded_hal_02::blocking::serial::Write; impl Write for Tx where diff --git a/src/spi/hal_02.rs b/src/spi/hal_02.rs index 310d2d37c..0b8c783c6 100644 --- a/src/spi/hal_02.rs +++ b/src/spi/hal_02.rs @@ -1,4 +1,4 @@ -pub use embedded_hal::spi::{Mode, Phase, Polarity}; +pub use embedded_hal_02::spi::{Mode, Phase, Polarity}; impl From for super::Polarity { fn from(p: Polarity) -> Self { @@ -29,7 +29,7 @@ impl From for super::Mode { mod nb { use super::super::{Error, FrameSize, Instance, Spi}; - use embedded_hal::spi::FullDuplex; + use embedded_hal_02::spi::FullDuplex; impl FullDuplex for Spi where @@ -49,7 +49,7 @@ mod nb { mod blocking { use super::super::{Error, Instance, Spi}; - use embedded_hal::blocking::spi::{Operation, Transactional, Transfer, Write, WriteIter}; + use embedded_hal_02::blocking::spi::{Operation, Transactional, Transfer, Write, WriteIter}; impl Transfer for Spi where diff --git a/src/spi/hal_1.rs b/src/spi/hal_1.rs index db9d9f51e..2fde852ab 100644 --- a/src/spi/hal_1.rs +++ b/src/spi/hal_1.rs @@ -1,4 +1,4 @@ -pub use embedded_hal_one::spi::{Error, ErrorKind, ErrorType, Mode, Phase, Polarity}; +pub use embedded_hal::spi::{Error, ErrorKind, ErrorType, Mode, Phase, Polarity}; use super::Instance; @@ -63,7 +63,7 @@ mod nb { mod blocking { use super::super::{FrameSize, Instance, Spi}; - use embedded_hal_one::spi::SpiBus; + use embedded_hal::spi::SpiBus; impl SpiBus for Spi where diff --git a/src/timer.rs b/src/timer.rs index 2f6087d6d..615f28677 100644 --- a/src/timer.rs +++ b/src/timer.rs @@ -713,12 +713,12 @@ impl FTimer { self.tim.set_prescaler(u16::try_from(psc - 1).unwrap()); } - /// Creates `Counter` that implements [embedded_hal::timer::CountDown] + /// Creates `Counter` that implements [embedded_hal_02::timer::CountDown] pub fn counter(self) -> Counter { Counter(self) } - /// Creates `Delay` that implements [embedded_hal::blocking::delay] traits + /// Creates `Delay` that implements [embedded_hal_02::blocking::delay] traits pub fn delay(self) -> Delay { Delay(self) } diff --git a/src/timer/counter.rs b/src/timer/counter.rs index a6ba1ed51..7b9adbfa3 100644 --- a/src/timer/counter.rs +++ b/src/timer/counter.rs @@ -69,7 +69,7 @@ impl CounterHz { } } -/// Periodic non-blocking timer that implements [embedded_hal::timer::CountDown] +/// Periodic non-blocking timer that implements [embedded_hal_02::timer::CountDown] pub struct Counter(pub(super) FTimer); impl Deref for Counter { diff --git a/src/timer/delay.rs b/src/timer/delay.rs index 2ca1594ae..d522f2549 100644 --- a/src/timer/delay.rs +++ b/src/timer/delay.rs @@ -58,7 +58,7 @@ impl SysDelay { } } -/// Periodic non-blocking timer that implements [embedded_hal::blocking::delay] traits. +/// Periodic non-blocking timer that implements [embedded_hal_02::blocking::delay] traits. /// /// ### Example: Millisecond precision /// diff --git a/src/timer/hal_02.rs b/src/timer/hal_02.rs index e7417cf8f..c622fab3b 100644 --- a/src/timer/hal_02.rs +++ b/src/timer/hal_02.rs @@ -3,7 +3,7 @@ //! TIM2 and TIM5 are a general purpose 32-bit auto-reload up/downcounter with //! a 16-bit prescaler. -use embedded_hal::{ +use embedded_hal_02::{ blocking::delay::{DelayMs, DelayUs}, timer::{Cancel, CountDown, Periodic}, }; @@ -139,7 +139,7 @@ impl Cancel for SysCounter { } } -impl embedded_hal::PwmPin for PwmChannel { +impl embedded_hal_02::PwmPin for PwmChannel { type Duty = u16; fn disable(&mut self) { @@ -159,7 +159,7 @@ impl embedded_hal::PwmPin for PwmChannel embedded_hal::Pwm for PwmHz +impl embedded_hal_02::Pwm for PwmHz where TIM: Instance + WithPwm, PINS: Pins, @@ -269,7 +269,7 @@ impl Cancel for Counter { } } -impl embedded_hal::Pwm for Pwm +impl embedded_hal_02::Pwm for Pwm where TIM: Instance + WithPwm, PINS: Pins, diff --git a/src/timer/hal_1.rs b/src/timer/hal_1.rs index ad6386ada..d022771d4 100644 --- a/src/timer/hal_1.rs +++ b/src/timer/hal_1.rs @@ -4,7 +4,7 @@ //! a 16-bit prescaler. use core::convert::Infallible; -use embedded_hal_one::delay::DelayNs; +use embedded_hal::delay::DelayNs; use super::{Delay, Instance, PwmChannel, SysDelay, WithPwm}; use fugit::ExtU32Ceil; @@ -33,13 +33,11 @@ impl DelayNs for Delay { } } -impl embedded_hal_one::pwm::ErrorType for PwmChannel { +impl embedded_hal::pwm::ErrorType for PwmChannel { type Error = Infallible; } -impl embedded_hal_one::pwm::SetDutyCycle - for PwmChannel -{ +impl embedded_hal::pwm::SetDutyCycle for PwmChannel { fn max_duty_cycle(&self) -> u16 { self.get_max_duty() } diff --git a/src/timer/pwm.rs b/src/timer/pwm.rs index 82dfdbe43..f21c0e2dd 100644 --- a/src/timer/pwm.rs +++ b/src/timer/pwm.rs @@ -1,13 +1,13 @@ //! Provides basic Pulse-width modulation (PWM) capabilities //! -//! There are 2 main structures [`Pwm`] and [`PwmHz`]. Both structures implement [`embedded_hal::Pwm`] and have some additional API. +//! There are 2 main structures [`Pwm`] and [`PwmHz`]. Both structures implement [`embedded_hal_02::Pwm`] and have some additional API. //! //! First one is based on [`FTimer`] with fixed prescaler //! and easy to use with [`fugit::TimerDurationU32`] for setting pulse width and period without advanced calculations. //! //! Second one is based on [`Timer`] with dynamic internally calculated prescaler and require [`fugit::Hertz`] to set period. //! -//! You can [`split`](Pwm::split) any of those structures on independent `PwmChannel`s if you need that implement [`embedded_hal::PwmPin`] +//! You can [`split`](Pwm::split) any of those structures on independent `PwmChannel`s if you need that implement [`embedded_hal_02::PwmPin`] //! but can't change PWM period. //! //! Also there is [`PwmExt`] trait implemented on `pac::TIMx` to simplify creating new structure. diff --git a/src/watchdog.rs b/src/watchdog.rs index e1ed76f5b..79201febd 100644 --- a/src/watchdog.rs +++ b/src/watchdog.rs @@ -2,7 +2,7 @@ use crate::pac::{DBGMCU, IWDG}; use core::fmt; -use embedded_hal::watchdog::{Watchdog, WatchdogEnable}; +use embedded_hal_02::watchdog::{Watchdog, WatchdogEnable}; use fugit::MillisDurationU32 as MilliSeconds; /// Wraps the Independent Watchdog (IWDG) peripheral