[−][src]Struct arduino_mkrzero::sercom::I2CMaster2
Represents the Sercom instance configured to act as an I2C Master. The embedded_hal blocking I2C traits are implemented by this instance.
Methods
impl I2CMaster2
[src]
pub fn new<F>(
clock: &Sercom2CoreClock,
freq: F,
sercom: SERCOM2,
pm: &mut PM,
sda: Sercom2Pad0,
scl: Sercom2Pad1
) -> I2CMaster2 where
F: Into<Hertz>,
[src]
clock: &Sercom2CoreClock,
freq: F,
sercom: SERCOM2,
pm: &mut PM,
sda: Sercom2Pad0,
scl: Sercom2Pad1
) -> I2CMaster2 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), );
pub fn free(self) -> (Sercom2Pad0, Sercom2Pad1, SERCOM2)
[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 WriteRead for I2CMaster2
[src]
type Error = I2CError
Error type
fn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), <I2CMaster2 as WriteRead>::Error>
[src]
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), <I2CMaster2 as WriteRead>::Error>
impl Read for I2CMaster2
[src]
type Error = I2CError
Error type
fn read(
&mut self,
addr: u8,
buffer: &mut [u8]
) -> Result<(), <I2CMaster2 as Read>::Error>
[src]
&mut self,
addr: u8,
buffer: &mut [u8]
) -> Result<(), <I2CMaster2 as Read>::Error>
impl Write for I2CMaster2
[src]
Auto Trait Implementations
impl Send for I2CMaster2
impl !Sync for I2CMaster2
Blanket Implementations
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,