Expand description
This HAL takes a layered approach.
- raw PAC peripherals
- HAL peripheral wrappers (under
peripherals
) - 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::gint::Gint;
pub use peripherals::gpio::Gpio;
pub use peripherals::hashcrypt::Hashcrypt;
pub use peripherals::inputmux::InputMux;
pub use peripherals::iocon::Iocon;
pub use peripherals::pfr::Pfr;
pub use peripherals::pint::Pint;
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::Pin;
pub use drivers::Pins;
pub use drivers::SpiMaster;
pub use drivers::UsbBus;
Modules§
- drivers
- Drivers for device functionality.
- macros
- peripherals
- HAL wrappers around raw PAC peripherals.
- prelude
- time
- This HAL now uses
embedded-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§
- boot_
to_ bootrom - This is a hack to jump to the bootrom without needing to assert ISP pin or destroy current firmware.
- 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 :-))