Struct esp32c3_hal::i2c::I2C

source ·
pub struct I2C<'d, T> { /* private fields */ }
Expand description

I2C peripheral container (I2C)

Implementations§

source§

impl<'d, T> I2C<'d, T>where T: Instance,

source

pub fn new<SDA, SCL>( i2c: impl Peripheral<P = T> + 'd, sda: impl Peripheral<P = SDA> + 'd, scl: impl Peripheral<P = SCL> + 'd, frequency: Rate<u32, 1, 1>, peripheral_clock_control: &mut PeripheralClockControl, clocks: &Clocks<'_> ) -> I2C<'d, T>where SDA: OutputPin + InputPin, SCL: OutputPin + InputPin,

Create a new I2C instance This will enable the peripheral but the peripheral won’t get automatically disabled when this gets dropped.

Trait Implementations§

source§

impl<T> Read<u8> for I2C<'_, T>where T: Instance,

§

type Error = Error

Error type
source§

fn read( &mut self, address: u8, buffer: &mut [u8] ) -> Result<(), <I2C<'_, T> as Read<u8>>::Error>

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

impl<T> Write<u8> for I2C<'_, T>where T: Instance,

§

type Error = Error

Error type
source§

fn write( &mut self, addr: u8, bytes: &[u8] ) -> Result<(), <I2C<'_, T> as Write<u8>>::Error>

Writes bytes to slave with address address Read more
source§

impl<T> WriteRead<u8> for I2C<'_, T>where T: Instance,

§

type Error = Error

Error type
source§

fn write_read( &mut self, address: u8, bytes: &[u8], buffer: &mut [u8] ) -> Result<(), <I2C<'_, T> as WriteRead<u8>>::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<'d, T> RefUnwindSafe for I2C<'d, T>where T: RefUnwindSafe,

§

impl<'d, T> Send for I2C<'d, T>where T: Send,

§

impl<'d, T> Sync for I2C<'d, T>where T: Sync,

§

impl<'d, T> Unpin for I2C<'d, T>where T: Unpin,

§

impl<'d, T> !UnwindSafe for I2C<'d, T>

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.