Skip to content

Commit 56a4c6a

Browse files
authored
Merge pull request #640 from MabezDev/eh02-begone
Don't recommend supporting eh0.2
2 parents 244abaa + 9cf0629 commit 56a4c6a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

docs/migrating-from-0.2-to-1.0.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -470,14 +470,15 @@ Here is the full listing of crates:
470470

471471
## Supporting both 0.2 and 1.0 in the same HAL
472472

473-
It is strongly recommended that HAL implementation crates provide implementations for both the `embedded-hal` v0.2 and v1.0 traits.
474-
This allows users to use drivers using either version seamlessly.
473+
It is not recommended to support 0.2 version of the HAL. Many of the traits are not fit for purpose which is already discussed in this document.
474+
475+
If you wish to support both the 0.2 and 1.0 release it is recommended to support embedded-hal version 0.2 behind a feature flag named `embedded-hal-02`.
475476

476477
The way you do it is adding a dependency on both versions in `Cargo.toml` like this:
477478

478479
```toml
479480
[dependencies]
480-
embedded-hal-02 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"] }
481+
embedded-hal-02 = { package = "embedded-hal", version = "0.2.7", features = ["unproven"], optional = true }
481482
embedded-hal-1 = { package = "embedded-hal", version = "1.0" }
482483
```
483484

@@ -489,6 +490,7 @@ This allows you to refer to the v0.2 traits under the `embedded_hal_02` name, an
489490
struct Input {...}
490491

491492
/// Implement the v0.2 traits on the struct.
493+
#[cfg(feature = "embedded-hal-02")]
492494
impl embedded_hal_02::digital::v2::InputPin for Input {
493495
type Error = Infallible;
494496

0 commit comments

Comments
 (0)