Struct itsybitsy_m4::I2CMaster2[][src]

pub struct I2CMaster2<P0, P1> where
    P0: CompatiblePad<Sercom = SERCOM2, PadNum = Pad0>,
    P1: CompatiblePad<Sercom = SERCOM2, PadNum = Pad1>, 
{ /* fields omitted */ }
Expand description

Represents the Sercom instance configured to act as an I2C Master. The embedded_hal blocking I2C traits are implemented by this instance.

Implementations

Configures the sercom instance to work as an I2C Master. The clock is obtained via the GenericClockGenerator type. freq specifies the bus frequency to use for I2C communication. There are typically a handful of values that tend to be supported; standard mode is 100.khz(), full speed mode is 400.khz(). The hardware in the atsamd device supports fast mode at 1.mhz() and fast mode, but there may be additional hardware configuration missing from the current software implementation that prevents that from working as-written today.

let mut i2c = I2CMaster3::new(
    &clocks.sercom3_core(&gclk0).unwrap(),
    400.khz(),
    p.device.SERCOM3,
    &mut p.device.MCLK,
    // Metro M0 express has I2C on pins PA22, PA23
    pins.pa22.into_pad(&mut pins.port),
    pins.pa23.into_pad(&mut pins.port),
);

Breaks the sercom device up into its constituent pins and the SERCOM instance. Does not make any changes to power management.

Trait Implementations

Error type

Reads enough bytes from slave with address to fill buffer Read more

Sends bytes to slave with address addr

Error type

Error type

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.