Crate lpc55_hal[][src]

This HAL takes a layered approach.

  1. raw PAC peripherals
  2. HAL peripheral wrappers (under peripherals)
  3. HAL drivers (under drivers, typically take ownership of one or more peripherals)

The middle layer is quite thin, notably we model pins and the clock tree as drivers.

In as much as possible, it is a goal for this HAL that drivers implement general interfaces (under traits).

The main intended use case of this HAL is in the context of RTIC.

To get started without RTIC, try something like:

let hal = hal::Peripherals::take().unwrap(); // layer 2
let pins = hal::Pins::take().unwrap(); // layer 3

let mut syscon = hal.syscon;
let mut gpio = hal.gpio.enabled(&mut syscon);
let mut iocon = hal.iocon.enabled(&mut syscon);

let mut red_led = pins.pio1_6
    .into_gpio_pin(&mut iocon, &mut gpio)
    .into_output(Level::High);

loop {
    red.set_low().unwrap();
    hal::wait_at_least(300_000);
    red.set_high().unwrap();
    hal::wait_at_least(300_000);
}

Re-exports

pub extern crate lpc55_pac as raw;
pub use typestates::init_state::Enabled;
pub use peripherals::adc::Adc;
pub use peripherals::anactrl::Anactrl;
pub use peripherals::casper::Casper;
pub use peripherals::ctimer::Ctimers;
pub use peripherals::dma::Dma;
pub use peripherals::flash::Flash;
pub use peripherals::flexcomm::Flexcomm;
pub use peripherals::gpio::Gpio;
pub use peripherals::gint::Gint;
pub use peripherals::hashcrypt::Hashcrypt;
pub use peripherals::inputmux::InputMux;
pub use peripherals::iocon::Iocon;
pub use peripherals::pint::Pint;
pub use peripherals::pfr::Pfr;
pub use peripherals::pmc::Pmc;
pub use peripherals::prince::Prince;
pub use peripherals::puf::Puf;
pub use peripherals::rng::Rng;
pub use peripherals::rtc::Rtc;
pub use peripherals::syscon::Syscon;
pub use peripherals::usbfs::Usbfs;
pub use peripherals::usbhs::Usbhs;
pub use peripherals::utick::Utick;
pub use drivers::ClockRequirements;
pub use drivers::FlashGordon;
pub use drivers::I2cMaster;
pub use drivers::SpiMaster;
pub use drivers::Pin;
pub use drivers::Pins;
pub use drivers::UsbBus;

Modules

drivers

Drivers for device functionality.

macros
peripherals

HAL wrappers around raw PAC peripherals.

prelude
time
traits
typestates

Macros

reg
reg_cluster
reg_read
stateful_peripheral_enable_disable
wrap_always_on_peripheral
wrap_stateful_peripheral

Structs

Peripherals

This is the entry point to the HAL API.

Functions

chip_revision

https://community.nxp.com/t5/LPC-Microcontrollers-Knowledge/Understanding-LPC55S6x-Revisions-and-Tools/ta-p/1117604

count_cycles
enable_cycle_counter
from
get_cycle_count
new
take

This is the main (monolithic) entry point to the HAL for non-RTIC applications. For RTIC, use hal::<Peripheral>::from(<raw_peripheral>) as needed.

uuid
wait_at_least

Delay of last resort :-))