Struct mlx9061x::Mlx9061x

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

MLX90614/MLX90615 device driver

Implementations§

source§

impl<E, I2C> Mlx9061x<I2C, Mlx90614>where I2C: WriteRead<Error = E> + Write<Error = E>,

source

pub fn new_mlx90614( i2c: I2C, address: SlaveAddr, eeprom_write_delay_ms: u8 ) -> Result<Self, Error<E>>

Create new instance of the MLX90614 device.

The slave address must match the address stored in the device EEPROM. To change it you need to connect first and then change it with set_address(). An invalid alternative slave address will return Error::InvalidInputData.

When writing to the EEPROM waiting a certain amount of time is necessary. This delay is configured through the eeprom_write_delay_ms parameter in milliseconds.

source

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

Read the ambient temperature in celsius degrees

source

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

Read the ambient temperature in celsius degrees as u16 value

Note ONLY use to avoid floating-point ops, as this gives less accurate temperature readings compared to using ambient_temperature().

source

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

Read the object 1 temperature in celsius degrees

source

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

Read the object 1 temperature in celsius degrees as u16 value

Note ONLY use to avoid floating-point ops, as this gives less accurate temperature readings compared to using object1_temperature().

source

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

Read the object 2 temperature in celsius degrees

Note that this is only available in dual-zone thermopile device variants.

source

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

Read the object 2 temperature in celsius degrees as u16 value

Note that this is only available in dual-zone thermopile device variants.

Note ONLY use to avoid floating-point ops, as this gives less accurate temperature readings compared to using object2_temperature().

source

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

Read the channel 1 raw IR data

source

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

Read the channel 2 raw IR data

source

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

Get emissivity epsilon

source

pub fn set_emissivity<D: DelayMs<u8>>( &mut self, epsilon: f32, delay: &mut D ) -> Result<(), Error<E>>

Set emissivity epsilon [0.1-1.0]

Wrong values will return Error::InvalidInputData.

source

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

Get the device ID

source§

impl<E, I2C> Mlx9061x<I2C, Mlx90615>where I2C: WriteRead<Error = E> + Write<Error = E>,

source

pub fn new_mlx90615( i2c: I2C, address: SlaveAddr, eeprom_write_delay_ms: u8 ) -> Result<Self, Error<E>>

Create new instance of the MLX90615 device.

The slave address must match the address stored in the device EEPROM. To change it you need to connect first and then change it with set_address(). An invalid alternative slave address will return Error::InvalidInputData.

When writing to the EEPROM waiting a certain amount of time is necessary. This delay is configured through the eeprom_write_delay_ms parameter in milliseconds.

source§

impl<E, I2C> Mlx9061x<I2C, Mlx90615>where I2C: WriteRead<Error = E> + Write<Error = E>,

source

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

Read the ambient temperature in celsius degrees

source

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

Read the ambient temperature in celsius degrees as u16 value

Note ONLY use to avoid floating-point ops, as this gives less accurate temperature readings compared to using ambient_temperature().

source

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

Read the object temperature in celsius degrees

source

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

Read the object temperature in celsius degrees

Note ONLY use to avoid floating-point ops, as this gives less accurate temperature readings compared to using object_temperature().

source

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

Read the raw IR data

source

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

Get emissivity epsilon

source

pub fn set_emissivity<D: DelayMs<u8>>( &mut self, epsilon: f32, delay: &mut D ) -> Result<(), Error<E>>

Set emissivity epsilon [0.0-1.0]

Wrong values will return Error::InvalidInputData.

source

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

Get the device ID

source§

impl<I2C, IC> Mlx9061x<I2C, IC>

source

pub fn destroy(self) -> I2C

Destroy driver instance, return I²C bus.

source§

impl<E, I2C> Mlx9061x<I2C, Mlx90614>where I2C: WriteRead<Error = E> + Write<Error = E>,

source

pub fn set_address<D: DelayMs<u8>>( &mut self, address: SlaveAddr, delay_ms: &mut D ) -> Result<(), Error<E>>

Change the device address

The address will be stored in the EEPROM. The address will be first cleared, before the new one is written. After each write the configured delay will be waited except the last time.

source

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

Enter sleep mode

After entering sleep, either destroy this driver to get the SDA/SCL pins back and call the wake() method or perform a hardware POR to wake the device.

source§

impl<E, I2C> Mlx9061x<I2C, Mlx90615>where I2C: WriteRead<Error = E> + Write<Error = E>,

source

pub fn set_address<D: DelayMs<u8>>( &mut self, address: SlaveAddr, delay_ms: &mut D ) -> Result<(), Error<E>>

Change the device address

The address will be stored in the EEPROM. The address will be first cleared, before the new one is written. After each write the configured delay will be waited except the last time.

source

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

Enter sleep mode

After entering sleep, either destroy this driver to get the SDA/SCL pins back and call the wake() method or perform a hardware POR to wake the device.

Trait Implementations§

source§

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

source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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