[−][src]Struct edgebadge::sercom::I2CMaster5
Represents the Sercom instance configured to act as an I2C Master. The embedded_hal blocking I2C traits are implemented by this instance.
Methods
impl<Sercom5Pad0, Sercom5Pad1> I2CMaster5<Sercom5Pad0, Sercom5Pad1>
[src]
pub fn new<F>(
clock: &Sercom5CoreClock,
freq: F,
sercom: SERCOM5,
mclk: &mut MCLK,
sda: Sercom5Pad0,
scl: Sercom5Pad1
) -> I2CMaster5<Sercom5Pad0, Sercom5Pad1> where
F: Into<Hertz>,
[src]
clock: &Sercom5CoreClock,
freq: F,
sercom: SERCOM5,
mclk: &mut MCLK,
sda: Sercom5Pad0,
scl: Sercom5Pad1
) -> I2CMaster5<Sercom5Pad0, Sercom5Pad1> 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.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) -> (Sercom5Pad0, Sercom5Pad1, SERCOM5)
[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<Sercom5Pad0, Sercom5Pad1> Read for I2CMaster5<Sercom5Pad0, Sercom5Pad1>
[src]
type Error = I2CError
Error type
fn read(
&mut self,
addr: u8,
buffer: &mut [u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as Read>::Error>
[src]
&mut self,
addr: u8,
buffer: &mut [u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as Read>::Error>
impl<Sercom5Pad0, Sercom5Pad1> Write for I2CMaster5<Sercom5Pad0, Sercom5Pad1>
[src]
type Error = I2CError
Error type
fn write(
&mut self,
addr: u8,
bytes: &[u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as Write>::Error>
[src]
&mut self,
addr: u8,
bytes: &[u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as Write>::Error>
Sends bytes to slave with address addr
impl<Sercom5Pad0, Sercom5Pad1> WriteRead for I2CMaster5<Sercom5Pad0, Sercom5Pad1>
[src]
type Error = I2CError
Error type
fn write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as WriteRead>::Error>
[src]
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), <I2CMaster5<Sercom5Pad0, Sercom5Pad1> as WriteRead>::Error>
Auto Trait Implementations
impl<Sercom5Pad0, Sercom5Pad1> Send for I2CMaster5<Sercom5Pad0, Sercom5Pad1> where
Sercom5Pad0: Send,
Sercom5Pad1: Send,
Sercom5Pad0: Send,
Sercom5Pad1: Send,
impl<Sercom5Pad0, Sercom5Pad1> !Sync for I2CMaster5<Sercom5Pad0, Sercom5Pad1>
impl<Sercom5Pad0, Sercom5Pad1> Unpin for I2CMaster5<Sercom5Pad0, Sercom5Pad1> where
Sercom5Pad0: Unpin,
Sercom5Pad1: Unpin,
Sercom5Pad0: Unpin,
Sercom5Pad1: Unpin,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T, U> TryFrom<U> 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<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,