You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/2023-12-28-embedded-hal-v1.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,17 @@ in_search_index = true
6
6
template = "page.html"
7
7
+++
8
8
9
-
The Rust Embedded Working Group is proud to announce the release of `embedded-hal` version 1.0, together with the
9
+
The Rust Embedded Working Group is proud to announce the release of `embedded-hal` version 1.0 together with the
10
10
companion crates `embedded-hal-bus`, `embedded-hal-async` and `embedded-hal-nb`.
11
11
12
-
Check out the [repository](https://github.com/rust-embedded/embedded-hal), the [API documentation](https://github.com/rust-embedded/embedded-hal#crates), and the [migration guide](https://github.com/rust-embedded/embedded-hal/blob/master/docs/migrating-from-0.2-to-1.0.md).
12
+
Check out the [repository](https://github.com/rust-embedded/embedded-hal), the [API documentation](https://github.com/rust-embedded/embedded-hal#crates) and the [migration guide](https://github.com/rust-embedded/embedded-hal/blob/master/docs/migrating-from-0.2-to-1.0.md).
13
13
14
-
The `embedded-hal` crates provide traits (interfaces) for using peripherals commonly available in microcontrollers,
15
-
such as GPIO, UART, SPI or I2C. They allow writing drivers (for sensors, displays, actuators, network adapters...) in
16
-
a generic way, so they work out of the box on any microcontroller with an `embedded-hal` implementation, without
14
+
The `embedded-hal` crates provide traits (interfaces) for using peripherals commonly available in microcontrollers
15
+
such as GPIO, UART, SPI or I2C. They allow writing drivers (for sensors, displays, actuators, network adapters, etc.) in
16
+
a generic way, so they work on any microcontroller with an `embedded-hal` implementation without
17
17
modifying them. It's a central piece of the Embedded Rust ecosystem, ensuring interoperability throughout.
18
18
19
-
The 1.0 release has been in the works for a while, since 2020. Now that it's out, we consider all
19
+
The 1.0 release has been in the works since 2020. Now that it's out, we consider all
20
20
traits in it to be *stable*. The plan is to extend `embedded-hal` with more traits in future 1.x releases,
21
21
not doing more breaking changes (i.e. there are no plans for a a 2.0 release). This will provide a stable
22
22
base for building HALs and drivers.
@@ -28,30 +28,30 @@ So, what's new in `embedded-hal` 1.0?
28
28
## Focus on drivers
29
29
30
30
Previous versions of `embedded-hal` had a dual goal of standardizing HAL APIs for end users, and allowing writing generic drivers.
31
-
With time, we've seen both goals sometimes conflict, and the latter one brings much more value, so 1.0 focuses on just that.
31
+
Experience has shown that these goals sometimes conflict with each other. As the latter brings much more value, 1.0 focuses on that.
32
32
33
33
We've simplified some traits and merged others to remove interoperability gotchas.
34
34
35
35
We've removed traits that were found to not be usable for generic drivers (most notably timers). The plan is to add
36
-
them back in the future, with a better suited design. See the migration guide for details and links to the tracking issues.
36
+
them back in the future, with a better design. See the [migration guide](https://github.com/rust-embedded/embedded-hal/blob/master/docs/migrating-from-0.2-to-1.0.md) for details and links to the tracking issues.
37
37
38
38
## Async
39
39
40
40
A new addition is the `embedded-hal-async` crate, containing async versions of the traits. With today's Rust 1.75 release,
41
-
async traits are available on Rust stable. They can be used with no heap allocations and no dynamic
41
+
async traits are available on Rust stable. They can be used without heap allocations or dynamic
42
42
dispatch (unlike previous macro-based polyfills like the `async-trait` crate), so they are a great fit for bare-metal embedded usage.
43
43
44
44
Most `embedded-hal-async` traits are async versions of their blocking counterparts.
45
45
46
-
However, one highlight is the [`digital::Wait`](https://docs.rs/embedded-hal-async/1.0.0/embedded_hal_async/digital/trait.Wait.html) trait, with methods like `wait_for_high()` and `wait_for_low()`. This trait adds support for using "IRQ" GPIO pins typically used by SPI and I2C devices to send an interrupt to the microcontroller. This has been a frequentlyrequested feature, and has turned out to be hard to abstract with traits, but is now feasible with async, and quite ergonomic to use even.
46
+
However, one highlight is the [`digital::Wait`](https://docs.rs/embedded-hal-async/1.0.0/embedded_hal_async/digital/trait.Wait.html) trait, with methods like `wait_for_high()` and `wait_for_low()`. This trait adds support for using "IRQ" GPIO pins typically used by SPI and I2C devices to send an interrupt to the microcontroller. This frequently-requested featureturned out to be hard to abstract with traits, but is now feasible in an ergonomic way with async.
47
47
48
48
## SPI bus sharing
49
49
50
50

51
51
52
-
The [`SpiDevice`](https://docs.rs/embedded-hal/1.0.0/embedded_hal/spi/index.html) trait now allows sharing a SPI bus between multiple devices, each selected with its own CS pin. The design allows for unrelated drivers to talk to different devices in the same bus, without conflicts, and without being aware of each other.
52
+
The [`SpiDevice`](https://docs.rs/embedded-hal/1.0.0/embedded_hal/spi/index.html) trait now allows sharing a SPI bus between multiple devices, each selected with its own CS pin. The design allows for unrelated drivers to talk to different devices in the same bus without conflicts and without being aware of each other.
53
53
54
-
The trait is agnostic to the kind of mutex/locking mechanism. The [`embedded-hal-bus`](https://docs.rs/embedded-hal-bus/0.1.0/embedded_hal_bus/spi/index.html) crate provides implementations for commonly used mutexes, but it is possible to write your own for e.g. the mutex of your choice RTOS.
54
+
The trait is agnostic about the kind of mutex/locking mechanism. The [`embedded-hal-bus`](https://docs.rs/embedded-hal-bus/0.1.0/embedded_hal_bus/spi/index.html) crate provides implementations for commonly used mutexes, but it is possible to write your own for e.g. the mutex of your favourite RTOS.
55
55
56
56
## Error handling
57
57
@@ -63,7 +63,7 @@ All error types are also required to implement `Debug`, so `.unwrap()` and simil
63
63
64
64
## Thanks
65
65
66
-
Thanks to the HAL team ([@therealprof](https://github.com/therealprof), [@ryankurte](https://github.com/ryankurte), [@eldruin](https://github.com/eldruin), [@dirbaio](https://github.com/Dirbaio), [@MabezDev](https://github.com/MabezDev)), and to everyone who helped with testing, feedback, and contributions for making `embedded-hal` 1.0 possible.
66
+
Thanks to the HAL team ([@therealprof](https://github.com/therealprof), [@ryankurte](https://github.com/ryankurte), [@eldruin](https://github.com/eldruin), [@dirbaio](https://github.com/Dirbaio), [@MabezDev](https://github.com/MabezDev)), and to everyone who helped with testing, feedback and contributions for making `embedded-hal` 1.0 possible.
67
67
68
68
Thanks to the Rust Foundation for sponsoring Dario Nieuwenhuis ([@dirbaio](https://github.com/Dirbaio))'s work on `embedded-hal` through the [Fellowship grants program](https://foundation.rust-lang.org/news/announcing-the-rust-foundation-s-2023-fellows/).
0 commit comments