pub struct Master<I: Instance, State, ModeState> { /* private fields */ }Expand description
API for the I2C master mode
You can get access to this struct through the I2C struct.
This struct has two type parameters that track its state:
Statetracks whether the I2C instance is enabled.ModeStatetracks whether the master mode is enabled.
§embedded-hal traits
embedded_hal::blocking::i2c::Readfor blocking readsembedded_hal::blocking::i2c::Writefor blocking writes
Implementations§
Source§impl<I, C> Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
impl<I, C> Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
Sourcepub fn write_all(
self,
address: u8,
buffer: &'static [u8],
channel: Channel<I::MstChannel, Enabled>,
) -> Result<Transfer<Ready, I::MstChannel, &'static [u8], Self>, Error>
pub fn write_all( self, address: u8, buffer: &'static [u8], channel: Channel<I::MstChannel, Enabled>, ) -> Result<Transfer<Ready, I::MstChannel, &'static [u8], Self>, Error>
Writes the provided buffer using DMA
§Panics
Panics, if the length of buffer is 0 or larger than 1024.
Sourcepub fn read_all(
self,
address: u8,
buffer: &'static mut [u8],
channel: Channel<I::MstChannel, Enabled>,
) -> Result<Transfer<Ready, I::MstChannel, Self, &'static mut [u8]>, Error>
pub fn read_all( self, address: u8, buffer: &'static mut [u8], channel: Channel<I::MstChannel, Enabled>, ) -> Result<Transfer<Ready, I::MstChannel, Self, &'static mut [u8]>, Error>
Reads until the provided buffer is full, using DMA
§Panics
Panics, if the length of buffer is 0 or larger than 1024.
Trait Implementations§
Source§impl<I, C> Dest for Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
impl<I, C> Dest for Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
Source§impl<I, C> Source for Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
impl<I, C> Source for Master<I, Enabled<PhantomData<C>>, Enabled>where
I: Instance,
Auto Trait Implementations§
impl<I, State, ModeState> Freeze for Master<I, State, ModeState>
impl<I, State, ModeState> RefUnwindSafe for Master<I, State, ModeState>
impl<I, State, ModeState> Send for Master<I, State, ModeState>
impl<I, State, ModeState> !Sync for Master<I, State, ModeState>
impl<I, State, ModeState> Unpin for Master<I, State, ModeState>
impl<I, State, ModeState> UnwindSafe for Master<I, State, ModeState>
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