Struct stm32wlxx_hal::i2c::I2c1

source ·
pub struct I2c1<PINS> { /* private fields */ }
Expand description

I2C1 peripheral operating in master mode

Implementations§

source§

impl<SCL, SDA> I2c1<(SCL, SDA)>

source

pub fn new( i2c: I2C1, pins: (SCL, SDA), freq_hz: u32, rcc: &mut RCC, pullup: bool, cs: &CriticalSection ) -> Selfwhere SCL: I2c1Scl + PinOps, SDA: I2c1Sda + PinOps,

Configures the I2C peripheral as master with the indicated frequency. The implementation takes care of setting the peripheral to standard/fast mode depending on the indicated frequency and generates values for SCLL and SCLH durations

Panics
  • Frequency is greater than 1 MHz
  • Resulting TIMINGR fields PRESC, SCLDEL, SCADEL, SCLH, SCLL are out of range
source

pub fn free(self) -> (I2C1, (SCL, SDA))

Releases the I2C peripheral and associated pins

Trait Implementations§

source§

impl<PINS: Debug> Debug for I2c1<PINS>

source§

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

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

impl<PINS> Read for I2c1<PINS>

§

type Error = Error

Error type
source§

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

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

impl<PINS> Write for I2c1<PINS>

§

type Error = Error

Error type
source§

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

Writes bytes to slave with address address Read more
source§

impl<PINS> WriteRead for I2c1<PINS>

§

type Error = Error

Error type
source§

fn write_read( &mut self, addr: 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<PINS> RefUnwindSafe for I2c1<PINS>where PINS: RefUnwindSafe,

§

impl<PINS> Send for I2c1<PINS>where PINS: Send,

§

impl<PINS> !Sync for I2c1<PINS>

§

impl<PINS> Unpin for I2c1<PINS>where PINS: Unpin,

§

impl<PINS> UnwindSafe for I2c1<PINS>where 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,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.