pub type Lpi2c3 = Lpi2c<Pins<P16, P17>, 3>;
Expand description
LPI2C3 peripheral.
- Pin 16 is the clock line.
- Pin 17 is the data line.
Use lpi2c
to create this driver.
Aliased Type§
struct Lpi2c3 { /* private fields */ }
Implementations
§impl<P, const N: u8> Lpi2c<P, N>
impl<P, const N: u8> Lpi2c<P, N>
pub fn is_controller_enabled(&self) -> bool
pub fn is_controller_enabled(&self) -> bool
Indicates if the controller is (true
) or is not (false
) enabled.
pub fn set_controller_enable(&mut self, enable: bool)
pub fn set_controller_enable(&mut self, enable: bool)
Enable (true
) or disable (false
) the controller.
pub fn reset_controller(&mut self)
pub fn reset_controller(&mut self)
Reset the controller.
Note that this may not not reset all peripheral state, like the controller enabled state.
pub fn release(self) -> (Instance<RegisterBlock, N>, P)
pub fn release(self) -> (Instance<RegisterBlock, N>, P)
Release the LPI2C components.
This does not change any component state; it releases the components as-is.
If you need to obtain the registers in a known, good state, consider calling
methods like reset_controller()
before releasing
the registers.
pub fn controller_status(&self) -> ControllerStatus
pub fn controller_status(&self) -> ControllerStatus
Read the controller status bits.
pub fn clear_controller_status(&self, status: ControllerStatus)
pub fn clear_controller_status(&self, status: ControllerStatus)
Clear the controller status bits that are set high.
The implementation will clear any read-only bits, so it’s OK to pass in
ControllerStatus::all()
.
pub fn clear_fifo(&mut self)
pub fn clear_fifo(&mut self)
Resets the transmit and receive FIFOs.
pub fn enqueue_controller_command(&self, command: ControllerCommand)
pub fn enqueue_controller_command(&self, command: ControllerCommand)
Enqueue a command into the controller transmit data register.
enqueue_controller_command
does not check that the FIFO can hold the
command. Check for the transmit data flag in the status
response to understand the FIFO’s state.
pub fn read_data_register(&self) -> Option<u8>
pub fn read_data_register(&self) -> Option<u8>
Read the controller receive data register.
Returns None
if there is no data in the receive FIFO.
pub fn disabled<R>(&mut self, func: impl FnOnce(&mut Disabled<'_, N>) -> R) -> R
pub fn disabled<R>(&mut self, func: impl FnOnce(&mut Disabled<'_, N>) -> R) -> R
Temporarily disable the LPI2C peripheral.
The handle to a Disabled
driver lets you modify
LPI2C settings that require a fully disabled peripheral.
pub fn interrupts(&self) -> Interrupts
pub fn interrupts(&self) -> Interrupts
Returns the bitflags that indicate enabled or disabled LPI2C interrupts.
pub fn set_interrupts(&self, interrupts: Interrupts)
pub fn set_interrupts(&self, interrupts: Interrupts)
Enable or disable LPI2C interrupts.
pub fn watermark(&self, direction: Direction) -> u8
pub fn watermark(&self, direction: Direction) -> u8
Returns the watermark level for the given direction.
pub fn controller_fifo_status(&self) -> ControllerFifoStatus
pub fn controller_fifo_status(&self) -> ControllerFifoStatus
Returns the FIFO status.
§impl<SCL, SDA, const N: u8> Lpi2c<Pins<SCL, SDA>, N>where
SDA: Pin<Signal = Sda, Module = Const<N>>,
SCL: Pin<Signal = Scl, Module = Const<N>>,
impl<SCL, SDA, const N: u8> Lpi2c<Pins<SCL, SDA>, N>where
SDA: Pin<Signal = Sda, Module = Const<N>>,
SCL: Pin<Signal = Scl, Module = Const<N>>,
pub fn new(
lpi2c: Instance<RegisterBlock, N>,
pins: Pins<SCL, SDA>,
timings: &Timing,
) -> Lpi2c<Pins<SCL, SDA>, N>
pub fn new( lpi2c: Instance<RegisterBlock, N>, pins: Pins<SCL, SDA>, timings: &Timing, ) -> Lpi2c<Pins<SCL, SDA>, N>
Create an LPI2C driver from an LPI2C instance and a pair of pins.
When this call returns, the LPI2C pins are configured for their LPI2C functions, the controller is enabled after reset, and the driver is using the provided timing configuration for the clock.
Trait Implementations
§impl<P, const N: u8> I2c for Lpi2c<P, N>
impl<P, const N: u8> I2c for Lpi2c<P, N>
§fn transaction(
&mut self,
address: u8,
operations: &mut [Operation<'_>],
) -> Result<(), <Lpi2c<P, N> as ErrorType>::Error>
fn transaction( &mut self, address: u8, operations: &mut [Operation<'_>], ) -> Result<(), <Lpi2c<P, N> as ErrorType>::Error>
§impl<P, const N: u8> WriteIterRead for Lpi2c<P, N>
impl<P, const N: u8> WriteIterRead for Lpi2c<P, N>
§fn write_iter_read<B>(
&mut self,
address: u8,
bytes: B,
buffer: &mut [u8],
) -> Result<(), <Lpi2c<P, N> as WriteIterRead>::Error>where
B: IntoIterator<Item = u8>,
fn write_iter_read<B>(
&mut self,
address: u8,
bytes: B,
buffer: &mut [u8],
) -> Result<(), <Lpi2c<P, N> as WriteIterRead>::Error>where
B: IntoIterator<Item = u8>,
address
and then reads enough bytes to fill buffer
in a
single transaction Read more