Struct lm75::Lm75

source ·
pub struct Lm75<I2C, IC> { /* private fields */ }
Expand description

LM75 device driver.

Implementations§

source§

impl<I2C, E> Lm75<I2C, Lm75>
where I2C: I2c<Error = E>,

source

pub fn new<A: Into<Address>>(i2c: I2C, address: A) -> Self

Create new instance of the LM75 device.

source§

impl<I2C, IC> Lm75<I2C, IC>

source

pub fn destroy(self) -> I2C

Destroy driver instance, return I²C bus instance.

source§

impl<I2C, IC, E> Lm75<I2C, IC>
where I2C: I2c<Error = E>, IC: ResolutionSupport<E>,

source

pub fn enable(&mut self) -> Result<(), Error<E>>

Enable the sensor (default state).

source

pub fn disable(&mut self) -> Result<(), Error<E>>

Disable the sensor (shutdown).

source

pub fn set_fault_queue(&mut self, fq: FaultQueue) -> Result<(), Error<E>>

Set the fault queue.

Set the number of consecutive faults that will trigger an OS condition.

source

pub fn set_os_polarity(&mut self, polarity: OsPolarity) -> Result<(), Error<E>>

Set the OS polarity.

source

pub fn set_os_mode(&mut self, mode: OsMode) -> Result<(), Error<E>>

Set the OS operation mode.

source

pub fn set_os_temperature(&mut self, temperature: f32) -> Result<(), Error<E>>

Set the OS temperature (celsius).

source

pub fn set_hysteresis_temperature( &mut self, temperature: f32 ) -> Result<(), Error<E>>

Set the hysteresis temperature (celsius).

source

pub fn read_temperature(&mut self) -> Result<f32, Error<E>>

Read the temperature from the sensor (celsius).

source§

impl<I2C, E> Lm75<I2C, Pct2075>
where I2C: I2c<Error = E>,

source

pub fn new_pct2075<A: Into<Address>>(i2c: I2C, address: A) -> Self

Create new instance of the PCT2075 device.

source

pub fn set_sample_rate(&mut self, period: u16) -> Result<(), Error<E>>

Set the sensor sample rate period in milliseconds (100ms increments).

For values outside of the range [100 - 3100] or those not a multiple of 100, `Error::InvalidInputData will be returned

source

pub fn read_sample_rate(&mut self) -> Result<u16, Error<E>>

Read the sample rate period from the sensor (ms).

Trait Implementations§

source§

impl<I2C: Debug, IC: Debug> Debug for Lm75<I2C, IC>

source§

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

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

impl<I2C: Default, IC: Default> Default for Lm75<I2C, IC>

source§

fn default() -> Lm75<I2C, IC>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<I2C, IC> RefUnwindSafe for Lm75<I2C, IC>
where I2C: RefUnwindSafe, IC: RefUnwindSafe,

§

impl<I2C, IC> Send for Lm75<I2C, IC>
where I2C: Send, IC: Send,

§

impl<I2C, IC> Sync for Lm75<I2C, IC>
where I2C: Sync, IC: Sync,

§

impl<I2C, IC> Unpin for Lm75<I2C, IC>
where I2C: Unpin, IC: Unpin,

§

impl<I2C, IC> UnwindSafe for Lm75<I2C, IC>
where I2C: UnwindSafe, IC: UnwindSafe,

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.