pub struct I2c<'d, M: Mode> { /* private fields */ }Expand description
I2C driver.
Implementations§
Source§impl<'d> I2c<'d, Async>
impl<'d> I2c<'d, Async>
Sourcepub fn new<T: Instance>(
_peri: Peri<'d, T>,
scl: Peri<'d, impl SclPin<T>>,
sda: Peri<'d, impl SdaPin<T>>,
_irq: impl Binding<T::Interrupt, InterruptHandler<T>>,
config: Config,
) -> Self
pub fn new<T: Instance>( _peri: Peri<'d, T>, scl: Peri<'d, impl SclPin<T>>, sda: Peri<'d, impl SdaPin<T>>, _irq: impl Binding<T::Interrupt, InterruptHandler<T>>, config: Config, ) -> Self
Create a new driver instance in async mode.
Sourcepub async fn read(
&mut self,
address: impl Into<Address>,
read: &mut [u8],
) -> Result<(), Error>
pub async fn read( &mut self, address: impl Into<Address>, read: &mut [u8], ) -> Result<(), Error>
Read from address into buffer.
Sourcepub async fn write(
&mut self,
address: impl Into<Address>,
write: &[u8],
) -> Result<(), Error>
pub async fn write( &mut self, address: impl Into<Address>, write: &[u8], ) -> Result<(), Error>
Write to address from buffer.
Source§impl<'d, M: Mode> I2c<'d, M>
impl<'d, M: Mode> I2c<'d, M>
Sourcepub fn blocking_read(
&mut self,
address: impl Into<Address>,
read: &mut [u8],
) -> Result<(), Error>
pub fn blocking_read( &mut self, address: impl Into<Address>, read: &mut [u8], ) -> Result<(), Error>
Read from address into buffer blocking caller until done.
Sourcepub fn blocking_write(
&mut self,
address: impl Into<Address>,
write: &[u8],
) -> Result<(), Error>
pub fn blocking_write( &mut self, address: impl Into<Address>, write: &[u8], ) -> Result<(), Error>
Write to address from buffer blocking caller until done.
Trait Implementations§
Source§impl<'d, M: Mode, A> I2c<A> for I2c<'d, M>
impl<'d, M: Mode, A> I2c<A> for I2c<'d, M>
Source§fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>
fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address. Read moreSource§impl<'d, A> I2c<A> for I2c<'d, Async>
impl<'d, A> I2c<A> for I2c<'d, Async>
Source§async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>
async fn write(&mut self, address: A, write: &[u8]) -> Result<(), Self::Error>
Writes bytes to slave with address
address. Read moreSource§impl<'d, M: Mode> SetConfig for I2c<'d, M>
impl<'d, M: Mode> SetConfig for I2c<'d, M>
Source§type ConfigError = ConfigError
type ConfigError = ConfigError
The error type that can occur if
set_config fails.Source§fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
fn set_config(&mut self, config: &Self::Config) -> Result<(), Self::ConfigError>
Set the configuration of the driver.
Source§impl<'d, M: Mode> Transactional for I2c<'d, M>
impl<'d, M: Mode> Transactional for I2c<'d, M>
Auto Trait Implementations§
impl<'d, M> !RefUnwindSafe for I2c<'d, M>
impl<'d, M> !UnwindSafe for I2c<'d, M>
impl<'d, M> Freeze for I2c<'d, M>
impl<'d, M> Send for I2c<'d, M>
impl<'d, M> Sync for I2c<'d, M>
impl<'d, M> Unpin for I2c<'d, M>
impl<'d, M> UnsafeUnpin for I2c<'d, M>
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