# rust-embedded/embedded-hal

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/rust-embedded-embedded-hal).**

2,600 stars · 269 forks · Rust · Apache-2.0

## Links

- GitHub: https://github.com/rust-embedded/embedded-hal
- awesome-repositories: https://awesome-repositories.com/repository/rust-embedded-embedded-hal.md

## Description

Embedded-hal is a hardware abstraction layer for embedded microcontrollers that defines common traits allowing peripheral drivers to remain entirely independent of specific hardware platforms. The library provides platform-agnostic interfaces that decouple driver logic from microcontroller architectures, utilizing zero-cost trait abstractions that compile down to direct hardware register manipulations without runtime overhead or memory allocation.

The project features asynchronous execution support and synchronous-to-asynchronous adaptation, enabling non-blocking peripheral operations and cooperative multitasking in resource-constrained environments. It includes shared bus coordination utilities that let multiple device drivers safely share a single communication bus without signal conflicts, alongside specialized communication protocol traits, polling methods, and stream mode management.

Additional capabilities cover byte-oriented stream processing for hardware and virtual connections, custom error handling via associated types, and automated diagnostic message formatting for inspecting system states across custom types.

## Tags

### Hardware & IoT

- [Hardware Abstraction Layers](https://awesome-repositories.com/f/hardware-iot/hardware-abstraction-layers.md) — Serves as a foundational hardware abstraction layer defining common traits for embedded microcontrollers.
- [Bus-Sharing Arbitration](https://awesome-repositories.com/f/hardware-iot/spi-bus-interfaces/bus-sharing-arbitration.md) — Supplies safe coordination utilities letting multiple device drivers share a communication bus safely. ([source](https://github.com/rust-embedded/embedded-hal#readme))
- [Asynchronous Hardware Interfaces](https://awesome-repositories.com/f/hardware-iot/asynchronous-hardware-interfaces.md) — Runs peripheral operations using modern asynchronous execution models with non-blocking await syntax. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal))
- [Embedded Peripheral Interfacing](https://awesome-repositories.com/f/hardware-iot/embedded-peripheral-interfacing.md) — Provides a set of platform-agnostic driver interface traits for embedded microcontrollers.
- [Polling Operations](https://awesome-repositories.com/f/hardware-iot/polling-operations.md) — Executes polling-based operations through supplementary modules to check hardware status. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal))

### Part of an Awesome List

- [Hardware Drivers](https://awesome-repositories.com/f/awesome-lists/devtools/hardware-drivers.md) — Defines platform-agnostic traits allowing peripheral drivers to remain independent of hardware platforms. ([source](https://github.com/rust-embedded/embedded-hal#readme))

### Data & Databases

- [Decoupled Driver Architectures](https://awesome-repositories.com/f/data-databases/storage-abstraction/storage-provider-drivers/task-and-device-drivers/decoupled-driver-architectures.md) — Deploys trait-based generic boundaries that decouple peripheral drivers from specific microcontrollers.

### DevOps & Infrastructure

- [Embedded Async Multitasking](https://awesome-repositories.com/f/devops-infrastructure/automation-orchestration/task-execution-frameworks/task-job-management/task-schedulers/os-scheduling-simulations/task-schedulers/embedded-async-multitasking.md) — Enables non-blocking peripheral operations and cooperative multitasking on resource-constrained microcontrollers.

### Operating Systems & Systems Programming

- [Hardware Abstraction Layers](https://awesome-repositories.com/f/operating-systems-systems-programming/hardware-interfacing-drivers/hardware-abstraction-layers.md) — Provides portable driver abstractions that work across different microcontroller platforms without modification.
- [Input-Output Interfaces](https://awesome-repositories.com/f/operating-systems-systems-programming/platform-development-integration/platform-support/environment-support-managers/no-std-environment-adapters/no-std-serialization-libraries/input-output-interfaces.md) — Provides custom input and output traits tailored for bare-metal and resource-constrained environments. ([source](https://github.com/rust-embedded/embedded-hal/tree/master/embedded-io))
- [Synchronous-to-Asynchronous Wrappers](https://awesome-repositories.com/f/operating-systems-systems-programming/synchronous-to-asynchronous-wrappers.md) — Converts blocking hardware operations into non-blocking asynchronous interfaces for cooperative multitasking.

### Programming Languages & Runtimes

- [Associated Types](https://awesome-repositories.com/f/programming-languages-runtimes/generic-types/associated-types.md) — Uses associated types on interface traits to allow custom error definitions without memory allocation.
- [Synchronous Adaptation Wrappers](https://awesome-repositories.com/f/programming-languages-runtimes/asynchronous-streams/stream-combinators/trait-definitions/synchronous-adaptation-wrappers.md) — Bridges synchronous and asynchronous stream traits to support flexible driver execution modes. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-io-adapters))

### Software Engineering & Architecture

- [Asynchronous Operation Execution](https://awesome-repositories.com/f/software-engineering-architecture/asynchronous-operation-execution.md) — Executes peripheral and I/O operations asynchronously without blocking the main execution flow. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/README.md))
- [Generalized Error Handling for Custom Types](https://awesome-repositories.com/f/software-engineering-architecture/error-handling-strategies/monadic-error-handling/generalized-error-handling-for-custom-types.md) — Implements associated error types on traits enabling custom error handling without dynamic dispatch or allocation. ([source](https://github.com/rust-embedded/embedded-hal/tree/master/embedded-io))
- [Bare-Metal Runtimes](https://awesome-repositories.com/f/software-engineering-architecture/pure-rust-implementations/bare-metal-runtimes.md) — Handles byte-oriented I/O operations in constrained bare-metal environments without standard libraries.
- [Zero-Allocation Runtime Models](https://awesome-repositories.com/f/software-engineering-architecture/zero-allocation-architectures/zero-allocation-runtime-models.md) — Provides stream and I/O traits that operate entirely without standard libraries or heap allocators.
- [Zero-Cost Abstraction Patterns](https://awesome-repositories.com/f/software-engineering-architecture/zero-overhead-abstractions/zero-cost-abstraction-patterns.md) — Defines zero-overhead interface contracts compiling directly down to hardware register manipulations.
- [Stream Mode Management](https://awesome-repositories.com/f/software-engineering-architecture/file-i-o-decoupling-patterns/read-write-stream-separation/stream-mode-management.md) — Separates blocking read and write operations from availability check traits to handle asynchronous data flow safely. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-io))

### Networking & Communication

- [Byte Stream Capture](https://awesome-repositories.com/f/networking-communication/raw-byte-stream-exchange/byte-stream-capture.md) — Models byte-oriented communication streams for hardware and virtual connections using reader and writer traits. ([source](https://github.com/rust-embedded/embedded-hal/blob/master/embedded-hal))
