Struct e310x_hal::i2c::I2c

source ·
pub struct I2c<I2C, PINS> { /* private fields */ }
Expand description

I2C abstraction

Implementations§

source§

impl<SDA, SCL> I2c<I2C0, (SDA, SCL)>

source

pub fn new(i2c: I2C0, sda: SDA, scl: SCL, speed: Speed, clocks: Clocks) -> Selfwhere SDA: SdaPin<I2C0>, SCL: SclPin<I2C0>,

Configures an I2C peripheral

source§

impl<I2C, PINS> I2c<I2C, PINS>

source

pub fn free(self) -> (I2C, PINS)

Releases the I2C peripheral and associated pins

Trait Implementations§

source§

impl<I2C: Deref<Target = RegisterBlock>, PINS> Read<u8> for I2c<I2C, PINS>

§

type Error = Error

Error type
source§

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

Reads enough bytes from slave with address to fill buffer Read more
source§

impl<I2C: Deref<Target = RegisterBlock>, PINS> Write<u8> for I2c<I2C, PINS>

§

type Error = Error

Error type
source§

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

Writes bytes to slave with address address Read more
source§

impl<I2C: Deref<Target = RegisterBlock>, PINS> WriteRead<u8> for I2c<I2C, PINS>

§

type Error = Error

Error type
source§

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

Writes bytes to slave with address address and then reads enough bytes to fill buffer in a single transaction Read more

Auto Trait Implementations§

§

impl<I2C, PINS> RefUnwindSafe for I2c<I2C, PINS>where I2C: RefUnwindSafe, PINS: RefUnwindSafe,

§

impl<I2C, PINS> Send for I2c<I2C, PINS>where I2C: Send, PINS: Send,

§

impl<I2C, PINS> Sync for I2c<I2C, PINS>where I2C: Sync, PINS: Sync,

§

impl<I2C, PINS> Unpin for I2c<I2C, PINS>where I2C: Unpin, PINS: Unpin,

§

impl<I2C, PINS> UnwindSafe for I2c<I2C, PINS>where I2C: UnwindSafe, PINS: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.