Config

Struct Config 

Source
pub struct Config {
    pub speed: Option<Hertz>,
    pub timing: Option<u32>,
    pub analog_filter: bool,
    pub digital_filter: u8,
    pub slave_address_1: u16,
    pub address_11bits: bool,
    pub slave_address_2: u8,
    pub slave_address_mask: SlaveAddressMask,
}

Fields§

§speed: Option<Hertz>§timing: Option<u32>§analog_filter: bool§digital_filter: u8§slave_address_1: u16§address_11bits: bool§slave_address_2: u8§slave_address_mask: SlaveAddressMask

Implementations§

Source§

impl Config

Source

pub fn new(speed: Hertz) -> Self

Source

pub fn with_timing(timing: u32) -> Self

Source

pub fn disable_analog_filter(self) -> Self

Source

pub fn enable_digital_filter(self, cycles: u8) -> Self

Source

pub fn timing_bits(&self, i2c_clk: Hertz) -> u32

Source

pub fn slave_address(&mut self, own_address: u8)

Slave address 1 as 7 bit address, in range 0 .. 127

Source

pub fn slave_address_11bits(&mut self, own_address: u16)

Slave address 1 as 11 bit address in range 0 .. 2047

Source

pub fn slave_address_2(&mut self, own_address: u8, mask: SlaveAddressMask)

Slave address 2 as 7 bit address in range 0 .. 127. The mask makes all slaves within the mask addressable

Trait Implementations§

Source§

impl From<Rate<u32, 1, 1>> for Config

Source§

fn from(speed: Hertz) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

§

impl Freeze for Config

§

impl RefUnwindSafe for Config

§

impl Send for Config

§

impl Sync for Config

§

impl Unpin for Config

§

impl UnwindSafe for Config

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.