Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Overview on embedded software

embedded_arch

  • You application that uses different drivers
  • The drivers depend on the embedded_hal
  • embedded_hal(_async): for platform agnostic drivers
  • Your specific board—that implements the embedded_hal traits. For example esp_hal.
  • Sometimes there is a board support crate, with higher level of abstraction than the one of the HAL.
  • PACs: The peripheral access crate is a safe rust wrapper around low level memory mapped registers. Generated from System View Descriptions (SVD) files, describing the register map for each peripheral (GPIO, ADC, I2C etc.). SVDs are given from the manufacturer.

Layers of Abstraction

From Comprehensive Rust

Showcasing setting a pin high and low - with highest level of abstraction to lowest

What's a Hardware Abstraction Layer (HAL)?

Abstracts away hardware specifics - e.g. GPIO pins, Timers etc.

#![allow(unused)]
fn main() {
use esp_hal::clock::CpuClock;
use esp_hal::gpio::{Level, Output, OutputConfig};
use esp_hal::main;
use esp_hal::time::{Duration, Instant};

// ... main

    let config = esp_hal::Config::default().with_cpu_clock(CpuClock::max());
    let peripherals = esp_hal::init(config);

    // GPIO 10 is labeled D10 on the Seed Xiao board
    let mut led = Output::new(peripherals.GPIO10, Level::Low, OutputConfig::default());
}

How can you use Drivers, that use embedded_hal?

As an example: Nerd-Neck:

Further Sources