pub struct I2c<I2C, PINS> { /* private fields */ }Expand description
I2C peripheral operating in master mode
Implementations§
Source§impl<I2C, SCL, SDA> I2c<I2C, (SCL, SDA)>
impl<I2C, SCL, SDA> I2c<I2C, (SCL, SDA)>
Sourcepub fn new(
i2c: I2C,
pins: (SCL, SDA),
freq: Hertz,
clocks: Clocks,
bus: &mut <I2C as RccBus>::Bus,
) -> Self
pub fn new( i2c: I2C, pins: (SCL, SDA), freq: Hertz, clocks: Clocks, bus: &mut <I2C as RccBus>::Bus, ) -> Self
Configures the I2C peripheral to work in master mode
§Panics
Panics if frequency freq can not be configured for the periphery.
Sourcepub unsafe fn peripheral(&mut self) -> &mut I2C
pub unsafe fn peripheral(&mut self) -> &mut I2C
Get access to the underlying register block.
§Safety
This function is not memory unsafe per se, but does not guarantee anything about assumptions of invariants made in this implementation.
Changing specific options can lead to un-expected behavior and nothing is guaranteed.
Sourcepub fn free(self) -> (I2C, (SCL, SDA))
pub fn free(self) -> (I2C, (SCL, SDA))
Releases the I2C peripheral and associated pins
Trait Implementations§
Auto Trait Implementations§
impl<I2C, PINS> Freeze for I2c<I2C, PINS>
impl<I2C, PINS> RefUnwindSafe for I2c<I2C, PINS>where
I2C: RefUnwindSafe,
PINS: RefUnwindSafe,
impl<I2C, PINS> Send for I2c<I2C, PINS>
impl<I2C, PINS> Sync for I2c<I2C, PINS>
impl<I2C, PINS> Unpin for I2c<I2C, PINS>
impl<I2C, PINS> UnwindSafe for I2c<I2C, PINS>where
I2C: UnwindSafe,
PINS: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more