Master

Struct Master 

Source
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:

  • State tracks whether the I2C instance is enabled.
  • ModeState tracks whether the master mode is enabled.

§embedded-hal traits

Implementations§

Source§

impl<I, C> Master<I, Enabled<PhantomData<C>>, Enabled>
where I: Instance,

Source

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.

Source

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, State, ModeState> Debug for Master<I, State, ModeState>
where I: Instance,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<I, C> Dest for Master<I, Enabled<PhantomData<C>>, Enabled>
where I: Instance,

Source§

type Error = Error

The error that can occur while finishing the transfer
Source§

fn is_valid(&self) -> bool

Indicates whether the destination is valid Read more
Source§

fn is_full(&self) -> bool

Indicates whether the destination is full Read more
Source§

fn increment(&self) -> DSTINC_A

The address increment during the transfer Read more
Source§

fn transfer_count(&self) -> Option<u16>

The transfer count, as defined by XFERCFG.XFERCOUNT Read more
Source§

fn end_addr(&mut self) -> *mut u8

The end address Read more
Source§

fn finish(&mut self) -> Result<(), Self::Error>

Tell the destination to finish the transfer
Source§

impl<I, C> Source for Master<I, Enabled<PhantomData<C>>, Enabled>
where I: Instance,

Source§

type Error = Error

The error that can occur while finishing the transfer
Source§

fn is_valid(&self) -> bool

Indicates whether the source is valid Read more
Source§

fn is_empty(&self) -> bool

Indicates whether the source is empty Read more
Source§

fn increment(&self) -> SRCINC_A

The address increment during the transfer Read more
Source§

fn transfer_count(&self) -> Option<u16>

The transfer count, as defined by XFERCFG.XFERCOUNT Read more
Source§

fn end_addr(&self) -> *const u8

The end address Read more
Source§

fn finish(&mut self) -> Result<(), Self::Error>

Tell the source to finish the transfer
Source§

impl<I, C> Read for Master<I, Enabled<PhantomData<C>>, Enabled>
where I: Instance,

Source§

fn read(&mut self, address: u8, buffer: &mut [u8]) -> Result<(), Self::Error>

Read from the I2C bus

Please refer to the embedded-hal documentation for details.

Source§

type Error = Error

Error type
Source§

impl<I, C> Write for Master<I, Enabled<PhantomData<C>>, Enabled>
where I: Instance,

Source§

fn write(&mut self, address: u8, data: &[u8]) -> Result<(), Self::Error>

Write to the I2C bus

Please refer to the embedded-hal documentation for details.

Source§

type Error = Error

Error type

Auto Trait Implementations§

§

impl<I, State, ModeState> Freeze for Master<I, State, ModeState>

§

impl<I, State, ModeState> RefUnwindSafe for Master<I, State, ModeState>
where State: RefUnwindSafe, ModeState: RefUnwindSafe, I: RefUnwindSafe,

§

impl<I, State, ModeState> Send for Master<I, State, ModeState>
where State: Send, ModeState: Send,

§

impl<I, State, ModeState> !Sync for Master<I, State, ModeState>

§

impl<I, State, ModeState> Unpin for Master<I, State, ModeState>
where State: Unpin, ModeState: Unpin,

§

impl<I, State, ModeState> UnwindSafe for Master<I, State, ModeState>
where State: UnwindSafe, ModeState: UnwindSafe, I: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.