#no-std #cortex-m #nxp #lpc #embedded-hal-impl

no-std lpc55-hal

Hardware Abstraction Layer (HAL) for the NXP LPC55S6x ARM Cortex-33 microcontrollers

5 releases (3 breaking)

new 0.3.0 Jun 10, 2021
0.2.1 May 2, 2021
0.1.1 Apr 23, 2021
0.0.4 Jan 31, 2021
0.0.3 Jan 6, 2020

#35 in Embedded development

Download history 4/week @ 2021-02-24 3/week @ 2021-03-03 1/week @ 2021-03-17 4/week @ 2021-03-24 6/week @ 2021-03-31 4/week @ 2021-04-07 4/week @ 2021-04-14 22/week @ 2021-04-21 51/week @ 2021-04-28 48/week @ 2021-05-05 40/week @ 2021-05-12 22/week @ 2021-05-19 285/week @ 2021-05-26 105/week @ 2021-06-02 93/week @ 2021-06-09

205 downloads per month

Apache-2.0 OR MIT

410KB
9K SLoC

Hardware Abstraction Layer (HAL) for NXP LPC55 series Cortex-M33 microcontrollers, written in Rust.

Build Status crates.io LICENSE Documentation Documentation (master)

LPC55 HAL provides a high-level interface to the features of these LPC55 family of MCUs, which is safe, convenient and efficient. It leverages Rust's type system to prevent common mistakes, such as attempting to use an uninitialized peripheral; these will be caught by compile-time errors.

This library implements the embedded-hal, a collection of traits intended to abstract over platform-dependencies, allowing firmware and drivers to be quite portable.

It also implements the usb-device framework.

Moreover, this library is compatible with the Cortex-M implementation of RTIC, a concurrency framework supporting preemptive multitasking with minimal footprint.

Status

Very much work-in-progress!

Current peripherals that mostly work:

  • I2C, SPI, Serial (with all pins)
  • USB FS device

Next up will be:

See also the low-level companion library LPC55S6x PAC.

This HAL is intended to work with cortex-m-rtic v0.5.

Documentation

The API documentation is located at https://docs.rs/lpc55-hal.

In addition, make fetch-docs downloads various vendor-supplied documentation:

Examples

The intention of the examples/ is to showcase the functionality of this library.

They run on the LPCXpresso55S69 development board.

After flashing J-Link firmware on the on-board LPCXpresso V2 debugger:

# in one terminal
make jlink

# in another terminal
make run-example EXAMPLE=rtic_led  # or any other example

Setup

To install rust, follow the install instructions from here: https://rust-embedded.github.io/book/intro/install.html

You also need following targets:

  • thumbv8m.main-none-eabi
  • thumbv8m.main-none-eabihf

Just use following command:

  rustup target add thumbv8m.main-none-eabi
  rustup target add thumbv8m.main-none-eabihf

License

Apache-2.0 or MIT.

Parts of the code are directly lifted from the LPC8xx HAL, others from the various STM32 HALs.

Dependencies

~14MB
~397K SLoC