embedded-hal

The embedded-hal crate provides a number of traits covering common microcontroller peripherals:

  • GPIO
  • PWM
  • Delay timers
  • I2C and SPI buses and devices

Similar traits for byte streams (e.g. UARTs), CAN buses and RNGs and broken out into embedded-io, embedded-can and rand_core respectively.

Other crates then implement drivers in terms of these traits, e.g. an accelerometer driver might need an I2C or SPI device instance.

  • The traits cover using the peripherals but not initialising or configuring them, as initialisation and configuration is usually highly platform-specific.
  • 还有适用于许多微控制器以及其他平台(例如 Raspberry Pi 上的 Linux)的实现。
  • embedded-hal-async provides async versions of the traits.
  • embedded-hal-nb provides another approach to non-blocking I/O, based on the nb crate.