@@ -83,28 +83,18 @@ list.
83
83
84
84
[ awesome-embedded-rust ] : https://github.com/rust-embedded/awesome-embedded-rust#driver-crates
85
85
86
- ### Adding support for an ` embedded-hal ` ` -alpha ` version in a HAL implementation
87
-
88
- It is possible for HAL implementations to support both the latest ` 0.2.x ` version of ` embedded-hal `
89
- as well as the latest ` 1.0.0-alpha ` version side by side. This has several big advantadges:
90
- - Allows for a more gradual upgrade process within the community.
91
- - Allows for a faster upgrade to ` 1.0 ` once it comes out.
92
- - Provides more oportunities to test the new ` embedded-hal ` version.
93
-
94
- This approach has been implemented in [ LPC8xx HAL] ( https://github.com/lpc-rs/lpc8xx-hal ) . Here are the steps:
95
-
96
- 1 . Add a dependency to the latest ` embedded-hal ` version to ` Cargo.toml ` .
97
- Use the ` package ` attribute to refer to it by another name, to prevent name collision
98
- ([ example] ( https://github.com/lpc-rs/lpc8xx-hal/blob/a2b774e8a9ef025fb5119ddfb09e1b190e510896/Cargo.toml#L44-L46 ) ).
99
- 2 . Import the traits into the module where they should be implemented.
100
- Change their name using ` as ` to prevent name collisions
101
- ([ example] ( https://github.com/lpc-rs/lpc8xx-hal/blob/a2b774e8a9ef025fb5119ddfb09e1b190e510896/src/gpio.rs#L49-L53 ) ).
102
- 3 . Implement the traits next to their non-alpha versions
103
- ([ example] ( https://github.com/lpc-rs/lpc8xx-hal/blob/a2b774e8a9ef025fb5119ddfb09e1b190e510896/src/gpio.rs#L767-L782 ) ).
104
-
105
- While none of this is hard, some HAL maintainers might prefer not to add a dependency on an alpha version.
106
- The main drawback of this approach is that it requires ongoing updates, as new ` embedded-hal ` alpha versions come out.
107
- As stated before, ` embedded-hal ` ` -alpha ` versions are _ not guaranteed_ to be compatible with each other.
86
+ ### Supporting different (alpha and non-alpha) HALs
87
+
88
+ [ embedded-hal-compat] ( https://github.com/ryankurte/embedded-hal-compat ) provides shims
89
+ to support interoperability between the latest ` 0.2.x ` and ` 1.0.0-alpha.N ` HALs, allowing one to use
90
+ incompatible HAL components (generally) without alteration.
91
+ See the [ docs] ( https://docs.rs/embedded-hal-compat/ ) for examples.
92
+
93
+ It is also possible for HAL implementations to support both the latest ` 0.2.x ` and ` 1.0.0-alpha.N ` versions
94
+ side by side, for an example see [ LPC8xx HAL] ( https://github.com/lpc-rs/lpc8xx-hal ) .
95
+
96
+ Note that ` embedded-hal ` ` -alpha ` versions are a moving target and _ not guaranteed_ to be compatible.
97
+ Because of this we only aim to support the latest ` -alpha ` .
108
98
109
99
## Minimum Supported Rust Version (MSRV)
110
100
0 commit comments