Skip to content

Commit 1481429

Browse files
authored
Merge pull request #753 from jannic/eh10
2 parents 6b040de + da0dfe5 commit 1481429

34 files changed

+301
-263
lines changed

rp2040-hal/Cargo.toml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ targets = ["thumbv6m-none-eabi"]
1717

1818
[dependencies]
1919
cortex-m = "0.7.2"
20-
embedded-hal = { version = "0.2.5", features = ["unproven"] }
21-
eh1_0_alpha = { package = "embedded-hal", version = "=1.0.0-rc.3", optional = true }
22-
eh_nb_1_0_alpha = { package = "embedded-hal-nb", version = "=1.0.0-rc.3", optional = true }
20+
embedded_hal_0_2 = { package = "embedded-hal", version = "0.2.5", features = ["unproven"] }
21+
embedded-hal = "1.0.0"
22+
embedded-hal-nb = "1.0.0"
2323
embedded-dma = "0.2.0"
2424
embedded-io = "0.6.1"
2525
fugit = "0.3.6"
@@ -79,9 +79,6 @@ rp2040-e5 = []
7979
# critical section that is safe for multicore use
8080
critical-section-impl = ["critical-section/restore-state-u8"]
8181

82-
# Support alpha release of embedded-hal
83-
eh1_0_alpha = ["dep:eh1_0_alpha", "dep:eh_nb_1_0_alpha"]
84-
8582
# Add conversion functions between chrono types and the rp2040-hal specific DateTime type
8683
chrono = ["dep:chrono"]
8784

@@ -192,7 +189,7 @@ required-features = ["critical-section-impl"]
192189

193190
[[example]]
194191
name = "pwm_blink_embedded_hal_1"
195-
required-features = ["critical-section-impl", "eh1_0_alpha"]
192+
required-features = ["critical-section-impl"]
196193

197194
[[example]]
198195
name = "rom_funcs"

rp2040-hal/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,11 @@ volatile until a 1.0.0 release.
9292
See the [open issues](https://github.com/rp-rs/rp-hal/issues) for a list of
9393
proposed features (and known issues).
9494

95-
### Support for embedded-hal 1.0
95+
### Implemented traits
9696

97-
We plan to support embedded-hal 1.0 soon after it is released.
98-
99-
For now, there is preliminary support for alpha/rc versions of embedded-hal, which can
100-
be enabled with the feature `eh1_0_alpha`. Please note that this support does not
101-
provide any semver compatibility guarantees: With that feature activated, there
102-
will be breaking changes even in minor versions of rp2040-hal.
103-
104-
Support for embedded-hal 1.0(-alpha/rc) exists in parallel to support for
105-
embedded-hal 0.2: Traits of both versions are implemented and can be used
106-
at the same time.
97+
This crate aims to implement all traits from embedded-hal, both version
98+
0.2 and 1.0. They can be used at the same time, so you can upgrade drivers
99+
incrementally.
107100

108101
<!-- CONTRIBUTING -->
109102
## Contributing

rp2040-hal/examples/adc.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use rp2040_hal as hal;
1919

2020
// Some traits we need
2121
use core::fmt::Write;
22-
use embedded_hal::adc::OneShot;
22+
// Embedded HAL 1.0.0 doesn't have an ADC trait, so use the one from 0.2
23+
use embedded_hal_0_2::adc::OneShot;
2324
use hal::fugit::RateExtU32;
2425
use rp2040_hal::Clock;
2526

rp2040-hal/examples/blinky.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use rp2040_hal as hal;
2121
use hal::pac;
2222

2323
// Some traits we need
24-
use embedded_hal::blocking::delay::DelayMs;
25-
use embedded_hal::digital::v2::OutputPin;
24+
use embedded_hal::delay::DelayNs;
25+
use embedded_hal::digital::OutputPin;
2626

2727
/// The linker will place this boot block at the start of our program image. We
2828
/// need this to help the ROM bootloader get our code up and running.

rp2040-hal/examples/dht11.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use rp2040_hal as hal;
2424
use hal::pac;
2525

2626
// Some traits we need
27-
use embedded_hal::digital::v2::OutputPin;
27+
use embedded_hal::digital::OutputPin;
2828
use hal::Clock;
2929

3030
/// The linker will place this boot block at the start of our program image. We

rp2040-hal/examples/gpio_dyn_pin_array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use rp2040_hal as hal;
2828
use hal::pac;
2929

3030
// Some traits we need
31-
use embedded_hal::blocking::delay::DelayMs;
32-
use embedded_hal::digital::v2::OutputPin;
31+
use embedded_hal::delay::DelayNs;
32+
use embedded_hal::digital::OutputPin;
3333

3434
/// The linker will place this boot block at the start of our program image. We
3535
/// need this to help the ROM bootloader get our code up and running.

rp2040-hal/examples/gpio_in_out.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ use rp2040_hal as hal;
2121
use hal::pac;
2222

2323
// Some traits we need
24-
use embedded_hal::digital::v2::InputPin;
25-
use embedded_hal::digital::v2::OutputPin;
24+
use embedded_hal::digital::InputPin;
25+
use embedded_hal::digital::OutputPin;
2626

2727
/// The linker will place this boot block at the start of our program image. We
2828
/// need this to help the ROM bootloader get our code up and running.
@@ -78,7 +78,7 @@ fn main() -> ! {
7878
let mut out_pin = pins.gpio25.into_push_pull_output();
7979

8080
// Configure GPIO 23 as an input
81-
let in_pin = pins.gpio23.into_pull_down_input();
81+
let mut in_pin = pins.gpio23.into_pull_down_input();
8282

8383
// Output is the opposite of the input
8484
loop {

rp2040-hal/examples/gpio_irq_example.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ use rp2040_hal as hal;
3434
use hal::pac;
3535

3636
// Some traits we need
37-
use embedded_hal::digital::v2::ToggleableOutputPin;
37+
use embedded_hal::digital::StatefulOutputPin;
3838

3939
// Our interrupt macro
4040
use hal::pac::interrupt;

rp2040-hal/examples/i2c.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use panic_halt as _;
1717
use rp2040_hal as hal;
1818

1919
// Some traits we need
20-
use embedded_hal::blocking::i2c::Write;
20+
use embedded_hal_0_2::blocking::i2c::Write;
2121
use hal::fugit::RateExtU32;
2222

2323
// A shorter alias for the Peripheral Access Crate, which provides low-level

rp2040-hal/examples/mem_to_mem_dma.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
use cortex_m::singleton;
1010
use cortex_m_rt::entry;
11-
use embedded_hal::digital::v2::OutputPin;
11+
use embedded_hal::digital::OutputPin;
1212
use hal::dma::{single_buffer, DMAExt};
1313
use hal::pac;
1414
use panic_halt as _;

0 commit comments

Comments
 (0)