Unleash the Power of Embedded Rust on ESP Microcontrollers

A bare-metal Hardware Abstraction Layer for ESP32, ESP32-C3, ESP32-S2, ESP32-S3, and ESP32-H2 microcontrollers, enabling robust and efficient embedded applications in Rust.

Explore Documentation

What is ESP-HAL?

esp-hal is a foundational crate for developing embedded applications on Espressif's popular ESP series of microcontrollers using the Rust programming language. It provides direct, safe, and idiomatic access to the underlying hardware peripherals, allowing developers to write high-performance, bare-metal code without the overhead of an operating system. It's part of the broader esp-rs ecosystem, empowering a new generation of embedded development.

Key Features

Bare-Metal Control

Gain direct, low-level access to ESP hardware peripherals for maximum performance and flexibility.

Extensive Peripheral Support

Comprehensive support for GPIO, SPI, I2C, UART, ADC, DAC, Timers, and more across various ESP chips.

Idiomatic Rust API

Leverage Rust's type system and safety features to write robust, error-resistant embedded code.

Asynchronous Capabilities

Built with async/await support, enabling efficient handling of concurrent operations without complex callbacks.

Cross-Platform Compatibility

Supports ESP32, ESP32-C3, ESP32-S2, ESP32-S3, and ESP32-H2, ensuring broad applicability for your projects.

Community Driven

Actively developed and maintained by a vibrant community of embedded Rust enthusiasts.

Get Started with ESP-HAL

Dive into embedded Rust development on your ESP microcontroller. Here's a quick taste of how simple it can be to blink an LED!


#![no_std]
#![no_main]

use esp_hal::{
    clock::CpuClock,
    delay::Delay,
    gpio::{Io, Level, Output, OutputConfig},
    main,
    time::{Duration, Instant},
};
use esp_backtrace as _;

#[main]
fn main() -> ! {
    let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
    let peripherals = esp_hal::init(config);

    let mut led = Output::new(peripherals.GPIO0, Level::High, OutputConfig::default());

    let mut delay = Delay::new();
    loop {
        led.toggle();
        delay.delay_millis(500);
    }
}
                

For more detailed instructions and examples, visit the official documentation.

Join the Community

Connect with other developers, contribute to the project, and get support.