Struct serpente::sercom::I2CMaster3
source · pub struct I2CMaster3<P0, P1>where
P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>,{ /* private fields */ }
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§
source§impl<P0, P1> I2CMaster3<P0, P1>where
P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>,
P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
impl<P0, P1> I2CMaster3<P0, P1>where P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>, P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
sourcepub fn new<F>(
clock: &Sercom3CoreClock,
freq: F,
sercom: SERCOM3,
pm: &mut PM,
sda: P0,
scl: P1
) -> I2CMaster3<P0, P1>where
F: Into<Hertz>,
pub fn new<F>( clock: &Sercom3CoreClock, freq: F, sercom: SERCOM3, pm: &mut PM, sda: P0, scl: P1 ) -> I2CMaster3<P0, P1>where F: Into<Hertz>,
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.PM,
// Metro M0 express has I2C on pins PA22, PA23
pins.pa22.into_pad(&mut pins.port),
pins.pa23.into_pad(&mut pins.port),
);
Trait Implementations§
source§impl<P0, P1> Read<u8> for I2CMaster3<P0, P1>where
P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>,
P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
impl<P0, P1> Read<u8> for I2CMaster3<P0, P1>where P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>, P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
source§impl<P0, P1> Write<u8> for I2CMaster3<P0, P1>where
P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>,
P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
impl<P0, P1> Write<u8> for I2CMaster3<P0, P1>where P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>, P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
source§impl<P0, P1> WriteRead<u8> for I2CMaster3<P0, P1>where
P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>,
P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
impl<P0, P1> WriteRead<u8> for I2CMaster3<P0, P1>where P1: CompatiblePad<Sercom = SERCOM3, PadNum = Pad1>, P0: CompatiblePad<Sercom = SERCOM3, PadNum = Pad0>,
Auto Trait Implementations§
impl<P0, P1> RefUnwindSafe for I2CMaster3<P0, P1>where P0: RefUnwindSafe, P1: RefUnwindSafe,
impl<P0, P1> Send for I2CMaster3<P0, P1>where P0: Send, P1: Send,
impl<P0, P1> !Sync for I2CMaster3<P0, P1>
impl<P0, P1> Unpin for I2CMaster3<P0, P1>where P0: Unpin, P1: Unpin,
impl<P0, P1> UnwindSafe for I2CMaster3<P0, P1>where P0: UnwindSafe, P1: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more