mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-04-25 16:54:32 +02:00
Write about embedded-hal
This commit is contained in:
parent
1d92abb1a7
commit
65749777c9
@ -242,6 +242,7 @@
|
|||||||
- [Microcontrollers](bare-metal/microcontrollers.md)
|
- [Microcontrollers](bare-metal/microcontrollers.md)
|
||||||
- [PACs](bare-metal/microcontrollers/pacs.md)
|
- [PACs](bare-metal/microcontrollers/pacs.md)
|
||||||
- [HAL crates](bare-metal/microcontrollers/hals.md)
|
- [HAL crates](bare-metal/microcontrollers/hals.md)
|
||||||
|
- [embedded-hal](bare-metal/microcontrollers/embedded-hal.md)
|
||||||
- [The type state pattern]()
|
- [The type state pattern]()
|
||||||
|
|
||||||
# Day 5A: Afternoon
|
# Day 5A: Afternoon
|
||||||
|
23
src/bare-metal/microcontrollers/embedded-hal.md
Normal file
23
src/bare-metal/microcontrollers/embedded-hal.md
Normal 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>
|
@ -1,5 +1,9 @@
|
|||||||
# HAL crates
|
# 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
|
```rust,editable,compile_fail
|
||||||
{{#include examples/src/bin/hal.rs:Example}}
|
{{#include examples/src/bin/hal.rs:Example}}
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user