Skip to content

Commit 3041f99

Browse files
committed
swap embedded-hals
1 parent f848188 commit 3041f99

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+92
-115
lines changed

CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
1111

1212
- shorten gpio ptr access
1313
- bump embedded-hal to `1.0.0-rc.3`
14+
- make `embedded-hal` `1.0` main implementation
1415

1516
## [v0.19.0] - 2023-12-11
1617

@@ -59,7 +60,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
5960

6061
### Changed
6162

62-
- implement `embedded_hal::blocking::i2c::Transactional` for `I2c` [#671]
63+
- implement `embedded_hal_02::blocking::i2c::Transactional` for `I2c` [#671]
6364

6465
### Fixed
6566

@@ -334,7 +335,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
334335

335336
### Fixed
336337

337-
- Fix `embedded_hal 1.0-alpha.7` version, public `PinMode`, update deps [#485]
338+
- Fix `embedded_hal_02 1.0-alpha.7` version, public `PinMode`, update deps [#485]
338339
- Remove the defmt feature/dependency name workaround [#479]
339340

340341
[#479]: https://github.com/stm32-rs/stm32f4xx-hal/pull/479
@@ -393,7 +394,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
393394
- Move `MonoTimer` from `timer` to dwt mode [#448]
394395
- Unify serial trait impls for embedded-hal 0.2 & 1.0 [#447]
395396
- Add possibility to select Timer master mode
396-
- Add inherent impl of `embedded_hal::Pwm` methods on `Pwm`s [#439]
397+
- Add inherent impl of `embedded_hal_02::Pwm` methods on `Pwm`s [#439]
397398
- Use `embedded-dma` v0.2 [#440]
398399
- Add LSI support for `Rtc` [#438]
399400
- Use `time` for `Rtc` instead of `rtcc`, add `rtc` example [#436]

Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ sdio-host = { version = "0.6.0", optional = true }
3939
embedded-dma = "0.2.0"
4040
bare-metal = { version = "1" }
4141
void = { default-features = false, version = "1.0.2" }
42-
embedded-hal = { features = ["unproven"], version = "0.2.7" }
43-
embedded-hal-nb = "=1.0.0-rc.3"
4442
display-interface = { version = "0.4.1", optional = true }
4543
fugit = "0.3.7"
4644
fugit-timer = "0.1.3"
@@ -54,9 +52,16 @@ vcell = "0.1.3"
5452
version = "0.3.14"
5553
default-features = false
5654

57-
[dependencies.embedded-hal-one]
58-
version = "=1.0.0-rc.3"
55+
[dependencies.embedded-hal-02]
5956
package = "embedded-hal"
57+
version = "0.2.7"
58+
features = ["unproven"]
59+
60+
[dependencies.embedded-hal]
61+
git = "https://github.com/rust-embedded/embedded-hal"
62+
63+
[dependencies.embedded-hal-nb]
64+
git = "https://github.com/rust-embedded/embedded-hal"
6065

6166
[dependencies.stm32_i2s_v12x]
6267
version = "0.5.0"

examples/analog-stopwatch-with-spi-ssd1306.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ fn main() -> ! {
113113
let mut delay = Timer::syst(cp.SYST, &clocks).delay();
114114

115115
ss.set_high();
116-
delay.delay_ms(100_u32);
116+
delay.delay_ms(100);
117117
ss.set_low();
118118

119119
// Set up the display
@@ -201,7 +201,7 @@ fn main() -> ! {
201201

202202
disp.flush().unwrap();
203203

204-
delay.delay_ms(100u32);
204+
delay.delay_ms(100);
205205
}
206206
}
207207

examples/delay-syst-blinky.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ fn main() -> ! {
3333
loop {
3434
// On for 1s, off for 1s.
3535
led.toggle();
36-
delay.delay_ms(1000_u32);
36+
delay.delay_ms(1000);
3737
}
3838
}
3939

examples/delay-timer-blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ fn main() -> ! {
3333
loop {
3434
// On for 1s, off for 3s.
3535
led.set_high();
36-
// Use `embedded_hal::DelayMs` trait
37-
delay.delay_ms(1000_u32);
36+
// Use `embedded_hal_02::DelayMs` trait
37+
delay.delay_ms(1000);
3838
led.set_low();
3939
// or use `fugit::ExtU32` trait
4040
delay.delay(3.secs());

examples/dwt-blinky.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ fn main() -> ! {
4040
// On for 1s, off for 1s.
4141
led1.set_high();
4242
led2.set_low();
43-
delay.delay_ms(1000_u32);
43+
delay.delay_ms(1000);
4444
sw.lap();
4545
led1.set_low();
4646
led2.set_high();
47-
delay.delay_ms(900_u32);
47+
delay.delay_ms(900);
4848
// Also you can measure with almost clock precision
49-
let cd: ClockDuration = dwt.measure(|| delay.delay_ms(100_u32));
49+
let cd: ClockDuration = dwt.measure(|| delay.delay_ms(100));
5050
let _t: u32 = cd.as_ticks(); // Should return 48MHz * 0.1s as u32
5151
let _t: f32 = cd.as_secs_f32(); // Should return ~0.1s as a f32
5252
let _t: f64 = cd.as_secs_f64(); // Should return ~0.1s as a f64

examples/ist7920-bidi-normal-spi.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fn main() -> ! {
5757

5858
let mut select_figure = 0;
5959
loop {
60-
delay.delay_ms(500_u16);
60+
delay.delay_ms(500);
6161
let (begin, end) = match select_figure {
6262
0 => {
6363
select_figure = 1;

examples/qei.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
use panic_halt as _;
1414

1515
use cortex_m_rt::entry;
16-
use embedded_hal::Direction as RotaryDirection;
16+
use embedded_hal_02::Direction as RotaryDirection;
1717
use stm32f4xx_hal::{pac, prelude::*, qei::Qei};
1818

1919
#[entry]
@@ -58,6 +58,6 @@ fn main() -> ! {
5858
current_count = new_count;
5959
}
6060

61-
delay.delay_ms(10_u32);
61+
delay.delay_ms(10);
6262
}
6363
}

examples/rng-display.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn main() -> ! {
105105
}
106106
disp.flush().unwrap();
107107
//delay a little while between refreshes so the display is readable
108-
delay_source.delay_ms(100u8);
108+
delay_source.delay_ms(100);
109109
}
110110
}
111111

examples/rtic-spi-slave-dma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#[rtic::app(device = stm32f4xx_hal::pac, peripherals = true, dispatchers = [TIM2])]
77
mod app {
88

9-
use embedded_hal::spi::{Mode, Phase, Polarity};
9+
use embedded_hal_02::spi::{Mode, Phase, Polarity};
1010
use hal::{
1111
dma::{
1212
config::DmaConfig, DmaFlag, MemoryToPeripheral, PeripheralToMemory, Stream0, Stream5,

examples/sd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ fn main() -> ! {
5151
Err(_err) => (),
5252
}
5353

54-
delay.delay_ms(1000u32);
54+
delay.delay_ms(1000);
5555
}
5656

5757
let nblocks = sdio.card().map(|c| c.block_count()).unwrap_or(0);

examples/serial-9bit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ fn main() -> ! {
105105
led_bit8.set_low();
106106
}
107107

108-
delay.delay_ms(10u32);
108+
delay.delay_ms(10);
109109
}
110110
}
111111
}

examples/spi-dma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use stm32f4xx_hal::dma::DmaFlag;
88
use core::cell::RefCell;
99
use cortex_m::interrupt::Mutex;
1010
use cortex_m_rt::entry;
11-
use embedded_hal::spi::{Mode, Phase, Polarity};
11+
use embedded_hal_02::spi::{Mode, Phase, Polarity};
1212
use stm32f4xx_hal::pac::interrupt;
1313
use stm32f4xx_hal::{
1414
dma::{config, MemoryToPeripheral, Stream4, StreamsTuple, Transfer},

examples/st7789-lcd.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ fn main() -> ! {
124124
let mut drawer = ColoredCircleDrawer::new(&center_points, &test_colors);
125125
loop {
126126
drawer.draw(&mut lcd).unwrap();
127-
delay.delay_ms(100u16);
127+
delay.delay_ms(100);
128128
}
129129
}
130130

examples/stopwatch-with-ssd1306-and-interrupts-and-dma-i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ fn main() -> ! {
254254

255255
disp.flush().unwrap();
256256

257-
delay.delay_ms(100u32);
257+
delay.delay_ms(100);
258258
}
259259
}
260260

examples/stopwatch-with-ssd1306-and-interrupts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ fn main() -> ! {
137137

138138
disp.flush().unwrap();
139139

140-
delay.delay_ms(100u32);
140+
delay.delay_ms(100);
141141
}
142142
}
143143

src/adc.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ macro_rules! adc {
860860
/// to sample for at a given ADC clock frequency
861861
pub fn configure_channel<CHANNEL>(&mut self, _channel: &CHANNEL, sequence: config::Sequence, sample_time: config::SampleTime)
862862
where
863-
CHANNEL: embedded_hal::adc::Channel<pac::$adc_type, ID=u8>
863+
CHANNEL: embedded_hal_02::adc::Channel<pac::$adc_type, ID=u8>
864864
{
865865
//Check the sequence is long enough
866866
self.adc_reg.sqr1.modify(|r, w| {
@@ -953,7 +953,7 @@ macro_rules! adc {
953953
/// Note that it reconfigures the adc sequence and doesn't restore it
954954
pub fn convert<PIN>(&mut self, pin: &PIN, sample_time: config::SampleTime) -> u16
955955
where
956-
PIN: embedded_hal::adc::Channel<pac::$adc_type, ID=u8>
956+
PIN: embedded_hal_02::adc::Channel<pac::$adc_type, ID=u8>
957957
{
958958
self.adc_reg.cr2.modify(|_, w| w
959959
.dma().clear_bit() //Disable dma
@@ -986,7 +986,7 @@ macro_rules! adc {
986986

987987
impl Adc<pac::$adc_type> {
988988
fn read<PIN>(&mut self, pin: &mut PIN) -> nb::Result<u16, ()>
989-
where PIN: embedded_hal::adc::Channel<pac::$adc_type, ID=u8>,
989+
where PIN: embedded_hal_02::adc::Channel<pac::$adc_type, ID=u8>,
990990
{
991991
let enabled = self.is_enabled();
992992
if !enabled {
@@ -1003,9 +1003,9 @@ macro_rules! adc {
10031003
}
10041004
}
10051005

1006-
impl<PIN> embedded_hal::adc::OneShot<pac::$adc_type, u16, PIN> for Adc<pac::$adc_type>
1006+
impl<PIN> embedded_hal_02::adc::OneShot<pac::$adc_type, u16, PIN> for Adc<pac::$adc_type>
10071007
where
1008-
PIN: embedded_hal::adc::Channel<pac::$adc_type, ID=u8>,
1008+
PIN: embedded_hal_02::adc::Channel<pac::$adc_type, ID=u8>,
10091009
{
10101010
type Error = ();
10111011

src/adc/f4.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use super::*;
33
macro_rules! adc_pins {
44
($($pin:ty => ($adc:ident, $chan:expr)),+ $(,)*) => {
55
$(
6-
impl embedded_hal::adc::Channel<pac::$adc> for $pin {
6+
impl embedded_hal_02::adc::Channel<pac::$adc> for $pin {
77
type ID = u8;
88
fn channel() -> u8 { $chan }
99
}

src/dwt.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,15 +97,15 @@ impl Delay {
9797
}
9898

9999
// Implement DelayUs/DelayMs for various integer types
100-
impl<T: Into<u64>> embedded_hal::blocking::delay::DelayUs<T> for Delay {
100+
impl<T: Into<u64>> embedded_hal_02::blocking::delay::DelayUs<T> for Delay {
101101
fn delay_us(&mut self, us: T) {
102102
// Convert us to ticks
103103
let start = DWT::cycle_count();
104104
let ticks = (us.into() * self.clock.raw() as u64) / 1_000_000;
105105
Delay::delay_ticks(start, ticks);
106106
}
107107
}
108-
impl<T: Into<u64>> embedded_hal::blocking::delay::DelayMs<T> for Delay {
108+
impl<T: Into<u64>> embedded_hal_02::blocking::delay::DelayMs<T> for Delay {
109109
fn delay_ms(&mut self, ms: T) {
110110
// Convert ms to ticks
111111
let start = DWT::cycle_count();
@@ -114,7 +114,7 @@ impl<T: Into<u64>> embedded_hal::blocking::delay::DelayMs<T> for Delay {
114114
}
115115
}
116116

117-
impl embedded_hal_one::delay::DelayNs for Delay {
117+
impl embedded_hal::delay::DelayNs for Delay {
118118
fn delay_ns(&mut self, ns: u32) {
119119
// Convert us to ticks
120120
let start = DWT::cycle_count();

src/fmpi2c/hal_02.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
mod blocking {
22
use super::super::{fmpi2c1, Error, FMPI2c, Instance};
33
use core::ops::Deref;
4-
use embedded_hal::blocking::i2c::{Read, Write, WriteRead};
4+
use embedded_hal_02::blocking::i2c::{Read, Write, WriteRead};
55

66
impl<I2C: Instance> WriteRead for FMPI2c<I2C>
77
where

src/fmpi2c/hal_1.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use embedded_hal_one::i2c::ErrorType;
1+
use embedded_hal::i2c::ErrorType;
22

33
use super::Instance;
44

@@ -9,9 +9,9 @@ impl<I2C: Instance> ErrorType for super::FMPI2c<I2C> {
99
mod blocking {
1010
use super::super::{fmpi2c1, FMPI2c, Instance};
1111
use core::ops::Deref;
12-
use embedded_hal_one::i2c::Operation;
12+
use embedded_hal::i2c::Operation;
1313

14-
impl<I2C: Instance> embedded_hal_one::i2c::I2c for FMPI2c<I2C>
14+
impl<I2C: Instance> embedded_hal::i2c::I2c for FMPI2c<I2C>
1515
where
1616
I2C: Deref<Target = fmpi2c1::RegisterBlock>,
1717
{

src/gpio.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ mod hal_02;
7171
mod hal_1;
7272
pub mod outport;
7373

74-
pub use embedded_hal::digital::v2::PinState;
74+
pub use embedded_hal_02::digital::v2::PinState;
7575

7676
use core::fmt;
7777

src/gpio/dynamic.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use super::*;
2-
use embedded_hal_one::digital::ErrorKind;
2+
use embedded_hal::digital::ErrorKind;
33

44
/// Pin type with dynamic mode
55
///
@@ -31,7 +31,7 @@ pub enum PinModeError {
3131
IncorrectMode,
3232
}
3333

34-
impl embedded_hal_one::digital::Error for PinModeError {
34+
impl embedded_hal::digital::Error for PinModeError {
3535
fn kind(&self) -> ErrorKind {
3636
ErrorKind::Other
3737
}

src/gpio/hal_02.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use super::{
55
PartiallyErasedPin, Pin, PinMode, PinState,
66
};
77

8-
use embedded_hal::digital::v2::{
8+
use embedded_hal_02::digital::v2::{
99
InputPin, IoPin, OutputPin, StatefulOutputPin, ToggleableOutputPin,
1010
};
1111

0 commit comments

Comments
 (0)