[][src]Struct trellis_m4::sercom::I2CMaster1

pub struct I2CMaster1<Sercom1Pad0, Sercom1Pad1> { /* fields omitted */ }

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

Methods

impl<Sercom1Pad0, Sercom1Pad1> I2CMaster1<Sercom1Pad0, Sercom1Pad1>[src]

pub fn new<F>(
    clock: &Sercom1CoreClock,
    freq: F,
    sercom: SERCOM1,
    mclk: &mut MCLK,
    sda: Sercom1Pad0,
    scl: Sercom1Pad1
) -> I2CMaster1<Sercom1Pad0, Sercom1Pad1> where
    F: Into<Hertz>, 
[src]

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),
);

pub fn free(self) -> (Sercom1Pad0, Sercom1Pad1, SERCOM1)[src]

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

Trait Implementations

impl<Sercom1Pad0, Sercom1Pad1> Write for I2CMaster1<Sercom1Pad0, Sercom1Pad1>[src]

type Error = I2CError

Error type

fn write(
    &mut self,
    addr: u8,
    bytes: &[u8]
) -> Result<(), <I2CMaster1<Sercom1Pad0, Sercom1Pad1> as Write>::Error>
[src]

Sends bytes to slave with address addr

impl<Sercom1Pad0, Sercom1Pad1> Read for I2CMaster1<Sercom1Pad0, Sercom1Pad1>[src]

type Error = I2CError

Error type

impl<Sercom1Pad0, Sercom1Pad1> WriteRead for I2CMaster1<Sercom1Pad0, Sercom1Pad1>[src]

type Error = I2CError

Error type

Auto Trait Implementations

impl<Sercom1Pad0, Sercom1Pad1> Unpin for I2CMaster1<Sercom1Pad0, Sercom1Pad1> where
    Sercom1Pad0: Unpin,
    Sercom1Pad1: Unpin

impl<Sercom1Pad0, Sercom1Pad1> !Sync for I2CMaster1<Sercom1Pad0, Sercom1Pad1>

impl<Sercom1Pad0, Sercom1Pad1> Send for I2CMaster1<Sercom1Pad0, Sercom1Pad1> where
    Sercom1Pad0: Send,
    Sercom1Pad1: Send

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