Struct esp32_hal::peripherals::I2C1

source ·
pub struct I2C1 { /* private fields */ }

Implementations§

source§

impl I2C1

source

pub unsafe fn steal() -> I2C1

Unsafely create an instance of this peripheral out of thin air.

§Safety

You must ensure that you’re only using one instance of this type at a time.

source

pub const PTR: *const <I2C1 as Deref>::Target = {0x3ff67000 as *const <esp32::I2C1 as core::ops::Deref>::Target}

Pointer to the register block

source

pub const fn ptr() -> *const <I2C1 as Deref>::Target

Return the pointer to the register block

Methods from Deref<Target = RegisterBlock>§

source

pub fn scl_low_period(&self) -> &Reg<SCL_LOW_PERIOD_SPEC>

0x00 -

source

pub fn ctr(&self) -> &Reg<CTR_SPEC>

0x04 -

source

pub fn sr(&self) -> &Reg<SR_SPEC>

0x08 -

source

pub fn to(&self) -> &Reg<TO_SPEC>

0x0c -

source

pub fn slave_addr(&self) -> &Reg<SLAVE_ADDR_SPEC>

0x10 -

source

pub fn rxfifo_st(&self) -> &Reg<RXFIFO_ST_SPEC>

0x14 -

source

pub fn fifo_conf(&self) -> &Reg<FIFO_CONF_SPEC>

0x18 -

source

pub fn data(&self) -> &Reg<DATA_SPEC>

0x1c -

source

pub fn int_raw(&self) -> &Reg<INT_RAW_SPEC>

0x20 -

source

pub fn int_clr(&self) -> &Reg<INT_CLR_SPEC>

0x24 -

source

pub fn int_ena(&self) -> &Reg<INT_ENA_SPEC>

0x28 -

source

pub fn int_status(&self) -> &Reg<INT_STATUS_SPEC>

0x2c -

source

pub fn sda_hold(&self) -> &Reg<SDA_HOLD_SPEC>

0x30 -

source

pub fn sda_sample(&self) -> &Reg<SDA_SAMPLE_SPEC>

0x34 -

source

pub fn scl_high_period(&self) -> &Reg<SCL_HIGH_PERIOD_SPEC>

0x38 -

source

pub fn scl_start_hold(&self) -> &Reg<SCL_START_HOLD_SPEC>

0x40 -

source

pub fn scl_rstart_setup(&self) -> &Reg<SCL_RSTART_SETUP_SPEC>

0x44 -

source

pub fn scl_stop_hold(&self) -> &Reg<SCL_STOP_HOLD_SPEC>

0x48 -

source

pub fn scl_stop_setup(&self) -> &Reg<SCL_STOP_SETUP_SPEC>

0x4c -

source

pub fn scl_filter_cfg(&self) -> &Reg<SCL_FILTER_CFG_SPEC>

0x50 -

source

pub fn sda_filter_cfg(&self) -> &Reg<SDA_FILTER_CFG_SPEC>

0x54 -

source

pub fn comd(&self, n: usize) -> &Reg<COMD_SPEC>

0x58..0x98 -

source

pub fn comd_iter(&self) -> impl Iterator<Item = &Reg<COMD_SPEC>>

Iterator for array of: 0x58..0x98 -

source

pub fn date(&self) -> &Reg<DATE_SPEC>

0xf8 -

source

pub fn fifo_start_addr(&self) -> &Reg<FIFO_START_ADDR_SPEC>

0x100 -

Trait Implementations§

source§

impl Debug for I2C1

source§

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

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

impl Deref for I2C1

§

type Target = <I2C1 as Deref>::Target

The resulting type after dereferencing.
source§

fn deref(&self) -> &<I2C1 as Deref>::Target

Dereferences the value.
source§

impl DerefMut for I2C1

source§

fn deref_mut(&mut self) -> &mut <I2C1 as Deref>::Target

Mutably dereferences the value.
source§

impl Instance for I2C1

source§

fn scl_output_signal(&self) -> OutputSignal

source§

fn scl_input_signal(&self) -> InputSignal

source§

fn sda_output_signal(&self) -> OutputSignal

source§

fn sda_input_signal(&self) -> InputSignal

source§

fn register_block(&self) -> &RegisterBlock

source§

fn i2c_number(&self) -> usize

source§

fn setup( &mut self, frequency: Rate<u32, 1, 1>, clocks: &Clocks<'_>, timeout: Option<u32> )

source§

fn reset(&self)

Resets the I2C controller (FIFO + FSM + command list)
source§

fn reset_command_list(&self)

Resets the I2C peripheral’s command registers
source§

fn set_filter(&mut self, sda_threshold: Option<u8>, scl_threshold: Option<u8>)

Sets the filter with a supplied threshold in clock cycles for which a pulse must be present to pass the filter
source§

fn set_frequency( &mut self, source_clk: Rate<u32, 1, 1>, bus_freq: Rate<u32, 1, 1>, timeout: Option<u32> )

Sets the frequency of the I2C interface by calculating and applying the associated timings - corresponds to i2c_ll_cal_bus_clk and i2c_ll_set_bus_timing in ESP-IDF
source§

fn configure_clock( &mut self, sclk_div: u32, scl_low_period: u32, scl_high_period: u32, scl_wait_high_period: u32, sda_hold_time: u32, sda_sample_time: u32, scl_rstart_setup_time: u32, scl_stop_setup_time: u32, scl_start_hold_time: u32, scl_stop_hold_time: u32, time_out_value: u32, time_out_en: bool )

source§

fn setup_write<'a, I>( &self, addr: u8, bytes: &[u8], cmd_iterator: &mut I ) -> Result<(), Error>
where I: Iterator<Item = &'a Reg<COMD_SPEC>>,

source§

fn perform_write<'a, I>( &self, addr: u8, bytes: &[u8], cmd_iterator: &mut I ) -> Result<(), Error>
where I: Iterator<Item = &'a Reg<COMD_SPEC>>,

source§

fn setup_read<'a, I>( &self, addr: u8, buffer: &mut [u8], cmd_iterator: &mut I ) -> Result<(), Error>
where I: Iterator<Item = &'a Reg<COMD_SPEC>>,

source§

fn perform_read<'a, I>( &self, addr: u8, buffer: &mut [u8], cmd_iterator: &mut I ) -> Result<(), Error>
where I: Iterator<Item = &'a Reg<COMD_SPEC>>,

source§

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

source§

fn clear_all_interrupts(&self)

source§

fn wait_for_completion(&self) -> Result<(), Error>

source§

fn check_errors(&self) -> Result<(), Error>

source§

fn update_config(&self)

source§

fn start_transmission(&self)

source§

fn fill_tx_fifo(&self, bytes: &[u8]) -> usize

source§

fn write_remaining_tx_fifo( &self, start_index: usize, bytes: &[u8] ) -> Result<(), Error>

source§

fn reset_fifo(&self)

Resets the transmit and receive FIFO buffers
source§

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

Send data bytes from the bytes array to a target slave with the address addr
source§

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

Read bytes from a target slave with the address addr The number of read bytes is deterimed by the size of the buffer argument
source§

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

Write bytes from the bytes array first and then read n bytes into the buffer array with n being the size of the array.
source§

impl Peripheral for I2C1

§

type P = I2C1

Peripheral singleton type
source§

unsafe fn clone_unchecked(&mut self) -> <I2C1 as Peripheral>::P

Unsafely clone (duplicate) a peripheral singleton. Read more
source§

fn into_ref<'a>(self) -> PeripheralRef<'a, Self::P>
where Self: 'a,

Convert a value into a PeripheralRef. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for I2C1

§

impl Send for I2C1

§

impl Sync for I2C1

§

impl Unpin for I2C1

§

impl UnwindSafe for I2C1

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where 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 T
where 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 T
where 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 T
where 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.