Skip to main content

WriteTransfer

Struct WriteTransfer 

Source
pub struct WriteTransfer<I2CX, SDA, SCL>
where I2CX: Instance,
{ /* private fields */ }
Expand description

A write driven by interrupts, owning the peripheral and the buffer.

Built by I2c::start_write. The handler for both I²C vectors calls on_interrupt; the transfer is over once is_done says so, and release takes it apart.

Implementations§

Source§

impl<I2CX, SDA, SCL> WriteTransfer<I2CX, SDA, SCL>
where I2CX: Instance,

Source

pub fn on_interrupt(&mut self)

Advances the transfer by one step. Call from both I²C interrupt handlers.

Reads the flags itself rather than trusting which vector it was entered from, so a wakeup this step has nothing to do with is simply ignored.

Source

pub fn is_done(&self) -> bool

Whether the transfer has ended, successfully or not.

Source

pub fn release( self, ) -> (I2c<I2CX, SDA, SCL>, &'static [u8], Option<Result<(), Error>>)

Gives back the peripheral, the buffer and the outcome.

None means the transfer was taken apart while still running, in which case the bus is released with a STOP first.

Trait Implementations§

Source§

impl<I2CX, SDA, SCL> Drop for WriteTransfer<I2CX, SDA, SCL>
where I2CX: Instance,

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

§

impl<I2CX, SDA, SCL> Freeze for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: Freeze,

§

impl<I2CX, SDA, SCL> RefUnwindSafe for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: RefUnwindSafe,

§

impl<I2CX, SDA, SCL> Send for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: Send,

§

impl<I2CX, SDA, SCL> Sync for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: Sync,

§

impl<I2CX, SDA, SCL> Unpin for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: Unpin,

§

impl<I2CX, SDA, SCL> UnsafeUnpin for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: UnsafeUnpin,

§

impl<I2CX, SDA, SCL> UnwindSafe for WriteTransfer<I2CX, SDA, SCL>
where I2c<I2CX, SDA, SCL>: UnwindSafe,

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 = !

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

fn try_from(value: U) -> Result<T, !>

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.