Skip to content

Commit 45aa43f

Browse files
authored
Update to embedded-hal 1.0 (#1723)
Now that the new version of `microbit-v2` and friends are finally released, we can use `embedded-hal` 1.0 for the bare metal morning.
1 parent c9e08fa commit 45aa43f

File tree

7 files changed

+84
-170
lines changed

7 files changed

+84
-170
lines changed
Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,36 @@
11
# `embedded-hal`
22

3-
The [`embedded-hal`](https://crates.io/crates/embedded-hal) crate provides a
4-
number of traits covering common microcontroller peripherals.
3+
The [`embedded-hal`] crate provides a number of traits covering common
4+
microcontroller peripherals:
55

66
- GPIO
7-
- ADC
8-
- I2C, SPI, UART, CAN
9-
- RNG
10-
- Timers
11-
- Watchdogs
7+
- PWM
8+
- Delay timers
9+
- I2C and SPI buses and devices
1210

13-
Other crates then implement
14-
[drivers](https://github.com/rust-embedded/awesome-embedded-rust#driver-crates)
15-
in terms of these traits, e.g. an accelerometer driver might need an I2C or SPI
16-
bus implementation.
11+
Similar traits for byte streams (e.g. UARTs), CAN buses and RNGs and broken out
12+
into [`embedded-io`], [`embedded-can`] and [`rand_core`] respectively.
13+
14+
Other crates then implement [drivers] in terms of these traits, e.g. an
15+
accelerometer driver might need an I2C or SPI device instance.
1716

1817
<details>
1918

19+
- The traits cover using the peripherals but not initialising or configuring
20+
them, as initialisation and configuration is usually highly platform-specific.
2021
- There are implementations for many microcontrollers, as well as other
2122
platforms such as Linux on Raspberry Pi.
22-
- There is work in progress on an `async` version of `embedded-hal`, but it
23-
isn't stable yet.
23+
- [`embedded-hal-async`] provides async versions of the traits.
24+
- [`embedded-hal-nb`] provides another approach to non-blocking I/O, based on
25+
the [`nb`] crate.
2426

2527
</details>
28+
29+
[drivers]: https://github.com/rust-embedded/awesome-embedded-rust#driver-crates
30+
[`embedded-can`]: https://crates.io/crates/embedded-can
31+
[`embedded-hal`]: https://crates.io/crates/embedded-hal
32+
[`embedded-hal-async`]: https://crates.io/crates/embedded-hal-async
33+
[`embedded-hal-nb`]: https://crates.io/crates/embedded-hal-nb
34+
[`embedded-io`]: https://crates.io/crates/embedded-io
35+
[`nb`]: https://crates.io/crates/nb
36+
[`rand_core`]: https://crates.io/crates/rand_core

src/bare-metal/microcontrollers/examples/Cargo.lock

Lines changed: 20 additions & 106 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/bare-metal/microcontrollers/examples/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ edition = "2021"
77
publish = false
88

99
[dependencies]
10-
cortex-m-rt = "0.7.3"
10+
cortex-m-rt = "0.7.4"
1111
embedded-hal = "1.0.0"
12-
microbit-v2 = "0.13.0"
13-
nrf52833-hal = "0.17.0"
12+
microbit-v2 = "0.14.0"
13+
nrf52833-hal = "0.17.1"
1414
nrf52833-pac = { version = "0.12.2", features = ["rt"] }
1515
panic-halt = "0.2.0"
1616

src/bare-metal/microcontrollers/examples/src/bin/board_support.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
extern crate panic_halt as _;
2020

2121
use cortex_m_rt::entry;
22-
use microbit::hal::prelude::*;
22+
use embedded_hal::digital::OutputPin;
2323
use microbit::Board;
2424

2525
#[entry]

0 commit comments

Comments
 (0)