1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2024-12-11 13:18:43 +02:00

Write about embedded-hal

This commit is contained in:
Andrew Walbran 2023-02-10 04:06:36 +00:00
parent 1d92abb1a7
commit 65749777c9
3 changed files with 28 additions and 0 deletions

View File

@ -242,6 +242,7 @@
- [Microcontrollers](bare-metal/microcontrollers.md)
- [PACs](bare-metal/microcontrollers/pacs.md)
- [HAL crates](bare-metal/microcontrollers/hals.md)
- [embedded-hal](bare-metal/microcontrollers/embedded-hal.md)
- [The type state pattern]()
# Day 5A: Afternoon

View File

@ -0,0 +1,23 @@
# `embedded-hal`
The [`embedded-hal`](https://crates.io/crates/embedded-hal) crate provides a number of traits
covering common microcontroller peripherals.
* GPIO
* ADC
* I2C, SPI, UART, CAN
* RNG
* Timers
* Watchdogs
Other crates then implement
[drivers](https://github.com/rust-embedded/awesome-embedded-rust#driver-crates) in terms of these
traits, e.g. an accelerometer driver might need an I2C or SPI bus implementation.
<details>
* There are implementations for many microcontrollers, as well as other platforms such as Linux on
Raspberry Pi.
* There is work in progress on an `async` version of `embedded-hal`, but it isn't stable yet.
</details>

View File

@ -1,5 +1,9 @@
# HAL crates
[HAL crates](https://github.com/rust-embedded/awesome-embedded-rust#hal-implementation-crates) for
many microcontrollers provide wrappers around various peripherals. These generally implement traits
from [`embedded-hal`](https://crates.io/crates/embedded-hal).
```rust,editable,compile_fail
{{#include examples/src/bin/hal.rs:Example}}
```