Trait esp32c3_hal::i2c::Instance
source · [−]pub trait Instance {
Show 14 methods
fn register_block(&self) -> &RegisterBlock;
fn i2c_number(&self) -> usize;
fn setup(
&mut self,
frequency: Rate<u32, 1, 1>,
clocks: &Clocks
) -> Result<(), SetupError> { ... }
fn reset(&mut self) { ... }
fn reset_command_list(&mut self) { ... }
fn set_filter(&mut self, sda_threshold: Option<u8>, scl_threshold: Option<u8>) { ... }
fn set_frequency(
&mut self,
source_clk: Rate<u32, 1, 1>,
bus_freq: Rate<u32, 1, 1>
) -> Result<(), SetupError> { ... }
fn execute_transmission(&mut self) -> Result<(), Error> { ... }
fn add_write_operation<'a, I>(
&self,
addr: u8,
bytes: &[u8],
cmd_iterator: &mut I,
include_stop: bool
) -> Result<(), Error>
where
I: Iterator<Item = &'a Reg<COMD_SPEC>>,
{ ... }
fn add_read_operation<'a, I>(
&self,
addr: u8,
buffer: &[u8],
cmd_iterator: &mut I
) -> Result<(), Error>
where
I: Iterator<Item = &'a Reg<COMD_SPEC>>,
{ ... }
fn reset_fifo(&mut self) { ... }
fn master_write(&mut self, addr: u8, bytes: &[u8]) -> Result<(), Error> { ... }
fn master_read(&mut self, addr: u8, buffer: &mut [u8]) -> Result<(), Error> { ... }
fn master_write_read(
&mut self,
addr: u8,
bytes: &[u8],
buffer: &mut [u8]
) -> Result<(), Error> { ... }
}
Expand description
I2C Peripheral Instance
Required Methods
source
fn register_block(&self) -> &RegisterBlock
source
fn i2c_number(&self) -> usize
Provided Methods
sourcefn reset_command_list(&mut self)
fn reset_command_list(&mut self)
Resets the I2C peripheral’s command registers
Sets the filter with a supplied threshold in clock cycles for which a pulse must be present to pass the filter
sourcefn set_frequency(
&mut self,
source_clk: Rate<u32, 1, 1>,
bus_freq: Rate<u32, 1, 1>
) -> Result<(), SetupError>
fn set_frequency(
&mut self,
source_clk: Rate<u32, 1, 1>,
bus_freq: Rate<u32, 1, 1>
) -> Result<(), SetupError>
Sets the frequency of the I2C interface by calculating and applying the associated timings
sourcefn execute_transmission(&mut self) -> Result<(), Error>
fn execute_transmission(&mut self) -> Result<(), Error>
Start the actual transmission on a previously configured command set
This includes the monitoring of the execution in the peripheral and the return of the operation outcome, including error states
sourcefn add_write_operation<'a, I>(
fn add_write_operation<'a, I>(
&self,
addr: u8,
bytes: &[u8],
cmd_iterator: &mut I,
include_stop: bool
) -> Result<(), Error>where
I: Iterator<Item = &'a Reg<COMD_SPEC>>,
sourcefn add_read_operation<'a, I>(
fn add_read_operation<'a, I>(
&self,
addr: u8,
buffer: &[u8],
cmd_iterator: &mut I
) -> Result<(), Error>where
I: Iterator<Item = &'a Reg<COMD_SPEC>>,
sourcefn reset_fifo(&mut self)
fn reset_fifo(&mut self)
Resets the transmit and receive FIFO buffers
Send data bytes from the bytes
array to a target slave with the
address addr
Read bytes from a target slave with the address addr
The number of read bytes is deterimed by the size of the buffer
argument