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
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.
Gain direct, low-level access to ESP hardware peripherals for maximum performance and flexibility.
Comprehensive support for GPIO, SPI, I2C, UART, ADC, DAC, Timers, and more across various ESP chips.
Leverage Rust's type system and safety features to write robust, error-resistant embedded code.
Built with async/await support, enabling efficient handling of concurrent operations without complex callbacks.
Supports ESP32, ESP32-C3, ESP32-S2, ESP32-S3, and ESP32-H2, ensuring broad applicability for your projects.
Actively developed and maintained by a vibrant community of embedded Rust enthusiasts.
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.
Connect with other developers, contribute to the project, and get support.