Struct RegisterBlock

Source
#[repr(C)]
pub struct RegisterBlock { pub cr1: u32, pub cr2: u32, pub oar1: u32, pub oar2: u32, pub dr: u32, pub sr1: u32, pub sr2: u32, pub ccr: u32, pub trise: u32, pub fltr: u32, }

Fields§

§cr1: u32§cr2: u32§oar1: u32§oar2: u32§dr: u32§sr1: u32§sr2: u32§ccr: u32§trise: u32§fltr: u32

Implementations§

Source§

impl RegisterBlock

Source

pub fn enable(&mut self)

Enable I2C peripheral

Source

pub fn disable(&mut self)

Disable I2C peripheral

Source

pub fn generate_start(&mut self)

Generate START condition

Source

pub fn generate_stop(&mut self)

Generate STOP condition

Source

pub fn set_ack(&mut self, enable: bool)

Enable/disable ACK

Source

pub fn is_start_sent(&self) -> bool

Check if START bit is sent

Source

pub fn is_addr_sent(&self) -> bool

Check if address is sent

Source

pub fn is_tx_empty(&self) -> bool

Check if transmit buffer is empty

Source

pub fn is_rx_not_empty(&self) -> bool

Check if receive buffer is not empty

Source

pub fn is_btf(&self) -> bool

Check if byte transfer is finished

Source

pub fn is_busy(&self) -> bool

Check if bus is busy

Source

pub fn write_data(&mut self, data: u8)

Write data

Source

pub fn read_data(&self) -> u8

Read data

Source

pub fn clear_addr_flag(&self)

Clear ADDR flag (read SR1 then SR2)

Source

pub fn set_clock_freq(&mut self, freq_mhz: u8)

Set I2C clock frequency (in MHz)

Auto Trait Implementations§

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>,

Source§

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>,

Source§

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.