[][src]Struct lpc82x_hal::i2c::I2C

pub struct I2C<State = Enabled> { /* fields omitted */ }

Interface to an I2C peripheral

Please refer to the module documentation for more information.

Limitations

This API has the following limitations:

  • Only I2C0 is supported.
  • Only master mode is supported.
  • Errors are not handled.

Additional limitations are documented on the specific methods that they apply to.

Methods

impl I2C<Disabled>[src]

pub fn enable(
    self,
    syscon: &mut Handle,
    _: Function<I2C0_SDA, Assigned<PIO0_11>>,
    _: Function<I2C0_SCL, Assigned<PIO0_10>>
) -> I2C<Enabled>
[src]

Enable the I2C peripheral

This method is only available, if I2C is in the Disabled state. Code that attempts to call this method when the peripheral is already enabled will not compile.

Consumes this instance of I2C and returns another instance that has its State type parameter set to Enabled.

Limitations

This method expects the I2C mode for PIO0_10 and PIO0_11 to be set to standard/fast mode. This is the default value.

The I2C clock frequency is hardcoded to a specific value. For unknown reasons, this seems to be 79.6 kHz.

impl<State> I2C<State>[src]

pub fn free(self) -> I2C0[src]

Return the raw peripheral

This method serves as an escape hatch from the HAL API. It returns the raw peripheral, allowing you to do whatever you want with it, without limitations imposed by the API.

If you are using this method because a feature you need is missing from the HAL API, please open an issue or, if an issue for your feature request already exists, comment on the existing issue, so we can prioritize it accordingly.

Trait Implementations

impl Read for I2C<Enabled>[src]

type Error = !

Error type

fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error>[src]

Read from the I2C bus

Please refer to the embedded-hal documentation for details.

Limitations

Reading multiple bytes should work, but has not been tested.

impl Write for I2C<Enabled>[src]

type Error = !

Error type

fn write(&mut self, address: u8, data: &[u8]) -> Result<(), Self::Error>[src]

Write to the I2C bus

Please refer to the embedded-hal documentation for details.

Limitations

Writing multiple bytes should work, but has not been tested.

Auto Trait Implementations

impl<State> Send for I2C<State> where
    State: Send

impl<State = Enabled<()>> !Sync for I2C<State>

Blanket Implementations

impl<T> From for T[src]

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

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto 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, U> Into for T where
    U: From<T>, 
[src]

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

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

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