pub struct I2C<'d, T> { /* private fields */ }Expand description
I2C peripheral container (I2C)
Implementations§
source§impl<'d, T> I2C<'d, T>where
T: Instance,
impl<'d, T> I2C<'d, T>where
T: Instance,
sourcepub fn new<SDA: OutputPin + InputPin, SCL: OutputPin + InputPin>(
i2c: impl Peripheral<P = T> + 'd,
sda: impl Peripheral<P = SDA> + 'd,
scl: impl Peripheral<P = SCL> + 'd,
frequency: HertzU32,
clocks: &Clocks<'_>
) -> Self
pub fn new<SDA: OutputPin + InputPin, SCL: OutputPin + InputPin>( i2c: impl Peripheral<P = T> + 'd, sda: impl Peripheral<P = SDA> + 'd, scl: impl Peripheral<P = SCL> + 'd, frequency: HertzU32, clocks: &Clocks<'_> ) -> Self
Create a new I2C instance This will enable the peripheral but the peripheral won’t get automatically disabled when this gets dropped.
sourcepub fn new_with_timeout<SDA: OutputPin + InputPin, SCL: OutputPin + InputPin>(
i2c: impl Peripheral<P = T> + 'd,
sda: impl Peripheral<P = SDA> + 'd,
scl: impl Peripheral<P = SCL> + 'd,
frequency: HertzU32,
clocks: &Clocks<'_>,
timeout: Option<u32>
) -> Self
pub fn new_with_timeout<SDA: OutputPin + InputPin, SCL: OutputPin + InputPin>( i2c: impl Peripheral<P = T> + 'd, sda: impl Peripheral<P = SDA> + 'd, scl: impl Peripheral<P = SCL> + 'd, frequency: HertzU32, clocks: &Clocks<'_>, timeout: Option<u32> ) -> Self
Create a new I2C instance with a custom timeout value. This will enable the peripheral but the peripheral won’t get automatically disabled when this gets dropped.
Trait Implementations§
source§impl<T> I2c for I2C<'_, T>where
T: Instance,
impl<T> I2c for I2C<'_, T>where
T: Instance,
source§fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, address: u8, bytes: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address. Read moreAuto Trait Implementations§
impl<'d, T> Freeze for I2C<'d, T>where
T: Freeze,
impl<'d, T> RefUnwindSafe for I2C<'d, T>where
T: RefUnwindSafe,
impl<'d, T> Send for I2C<'d, T>where
T: Send,
impl<'d, T> Sync for I2C<'d, T>where
T: Sync,
impl<'d, T> Unpin for I2C<'d, T>where
T: Unpin,
impl<'d, T> !UnwindSafe for I2C<'d, T>
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