[][src]Struct atmega32u4_hal::i2c::I2c

pub struct I2c<CLOCK: Clock, M> { /* fields omitted */ }

I2C based on ATmega32U4's TWI peripheral

Implementations

impl<CLOCK> I2c<CLOCK, I2cPullUp> where
    CLOCK: Clock
[src]

pub fn new(
    p: TWI,
    sda: PD1<Input<PullUp>>,
    scl: PD0<Input<PullUp>>,
    speed: u32
) -> I2c<CLOCK, I2cPullUp>
[src]

Initialize the I2C bus

new() will enable the internal pull-ups to comply with the I2C specification. If you have external pull-ups connected, please use new_with_external_pullup() instead.

impl<CLOCK> I2c<CLOCK, I2cFloating> where
    CLOCK: Clock
[src]

pub fn new_with_external_pullup(
    p: TWI,
    sda: PD1<Input<Floating>>,
    scl: PD0<Input<Floating>>,
    speed: u32
) -> I2c<CLOCK, I2cFloating>
[src]

Initialize the I2C bus, without enabling internal pull-ups

This function should be used if your hardware design includes pull-up resistors outside the MCU. If you do not have these, please use new() instead.

impl<CLOCK, M> I2c<CLOCK, M> where
    CLOCK: Clock
[src]

pub fn ping_slave(&mut self, addr: u8, dir: Direction) -> Result<bool, Error>[src]

Check whether a slave answers ACK for a given address

Note that some devices might not respond to both read and write operations.

impl<CLOCK, M> I2c<CLOCK, M> where
    CLOCK: Clock,
    Delay<CLOCK>: DelayMs<u16>, 
[src]

pub fn i2cdetect<W: uWrite>(
    &mut self,
    w: &mut W,
    dir: Direction
) -> Result<(), W::Error>
[src]

Output an i2cdetect-like summary of connected slaves to a serial device

Note that output for Read and Write might differ.

Trait Implementations

impl<CLOCK, M> Read for I2c<CLOCK, M> where
    CLOCK: Clock
[src]

type Error = Error

Error type

impl<CLOCK, M> Write for I2c<CLOCK, M> where
    CLOCK: Clock
[src]

type Error = Error

Error type

impl<CLOCK, M> WriteRead for I2c<CLOCK, M> where
    CLOCK: Clock
[src]

type Error = Error

Error type

Auto Trait Implementations

impl<CLOCK, M> Send for I2c<CLOCK, M> where
    CLOCK: Send,
    M: Send

impl<CLOCK, M> !Sync for I2c<CLOCK, M>

impl<CLOCK, M> Unpin for I2c<CLOCK, M> where
    CLOCK: Unpin,
    M: Unpin

Blanket Implementations

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

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

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

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

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

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> 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.