[][src]Struct lpc81x_hal::Peripherals

pub struct Peripherals {
    pub pins: Pins,
    pub pin_inputs: PinInputs,
    pub pin_interrupts: Inactive,
    pub spi0: SPI0<Inactive, Unassigned, Unassigned, Unassigned, Unassigned>,
    pub spi1: SPI1<Inactive, Unassigned, Unassigned, Unassigned, Unassigned>,
    pub i2c: I2C<Unassigned, Unassigned, Host<Inactive>, Device<Inactive>, Monitor<Inactive>>,
}

Singleton container for the peripherals modeled by this HAL crate.

All of the functionality of this library begins in the Peripherals singleton. The initial content represents the state of the system and peripherals at reset (after the built-in bootloader launches the user program) and these objects can be moved elsewhere to configure the peripherals for a particular application.

All of the main interface peripherals take pin objects as arguments. Unassigned pins start off in the pins field of Peripheraps, and can be moved elsewhere to assign them to functions. This interface ensures at compile time that two outputs cannot be sharing the same pin, which is forbidden by the LPC81x "switch matrix" peripheral.

Fields

pins: Pins

The main accessors for the device pins.

pin_inputs: PinInputs

Alternative accessors for the device pins' digital inputs.

This is an alternative to pins that provides access only to the input parts, and crucially allows access to the input parts even when ownership of the members of pins have been transferred elsewhere.

pin_interrupts: Inactivespi0: SPI0<Inactive, Unassigned, Unassigned, Unassigned, Unassigned>

The first SPI peripheral, initially inactive.

spi1: SPI1<Inactive, Unassigned, Unassigned, Unassigned, Unassigned>

The second SPI peripheral, initially inactive.

This device is only present in models LPC812M101JDH16 and LPC812M101JDH20 (TSSOP packages).

i2c: I2C<Unassigned, Unassigned, Host<Inactive>, Device<Inactive>, Monitor<Inactive>>

Methods

impl Peripherals[src]

pub fn take() -> Option<Self>[src]

Obtain (only once) the singleton Peripherals object.

On subsequent calls, returns None.

pub unsafe fn steal() -> Self[src]

pub fn model(&self) -> Model[src]

Returns a value representing the specific LPC8xx model of the current device, allowing dynamic inspection of some details that vary by model.

pub fn release_pac(self) -> Peripherals[src]

Consumes the HAL-level peripherals to unwrap the PAC-level peripherhals.

pub unsafe fn steal_pac(&self) -> Peripherals[src]

Returns the PAC-level peripherals while leaving the caller with ownership of the HAL-level peripherals too.

This is unsafe because the raw PAC peripherals API may be used to reconfigure the hardware in a way that the HAL isn't aware of.

Auto Trait Implementations

impl Send for Peripherals

impl !Sync for Peripherals

impl Unpin for Peripherals

Blanket Implementations

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self