pub struct Tmp006<I2C> { /* private fields */ }
Expand description
TMP006 device driver.
Implementations
sourceimpl<I2C, E> Tmp006<I2C>where
I2C: Write<Error = E>,
impl<I2C, E> Tmp006<I2C>where
I2C: Write<Error = E>,
sourcepub fn enable(&mut self) -> Result<(), Error<E>>
pub fn enable(&mut self) -> Result<(), Error<E>>
Enable the sensor (default state).
Sensor and ambient continuous conversion.
Note: calling this clears the data-ready bit.
sourcepub fn disable(&mut self) -> Result<(), Error<E>>
pub fn disable(&mut self) -> Result<(), Error<E>>
Disable the sensor (power-down).
Note: calling this clears the data-ready bit.
sourcepub fn reset(&mut self) -> Result<(), Error<E>>
pub fn reset(&mut self) -> Result<(), Error<E>>
Reset the sensor (software reset).
Note: calling this clears the data-ready bit.
sourcepub fn enable_drdy_pin(&mut self) -> Result<(), Error<E>>
pub fn enable_drdy_pin(&mut self) -> Result<(), Error<E>>
Enable DRDY pin.
Note: calling this clears the data-ready bit.
sourcepub fn disable_drdy_pin(&mut self) -> Result<(), Error<E>>
pub fn disable_drdy_pin(&mut self) -> Result<(), Error<E>>
Disable DRDY pin.
Note: calling this clears the data-ready bit.
sourcepub fn set_conversion_rate(
&mut self,
rate: ConversionRate
) -> Result<(), Error<E>>
pub fn set_conversion_rate(
&mut self,
rate: ConversionRate
) -> Result<(), Error<E>>
Set the ADC conversion rate.
Note: calling this clears the data-ready bit.
sourceimpl<I2C, E> Tmp006<I2C>where
I2C: WriteRead<Error = E>,
impl<I2C, E> Tmp006<I2C>where
I2C: WriteRead<Error = E>,
sourcepub fn read_object_temperature(
&mut self,
calibration_factor: f64
) -> Result<f64, Error<E>>
pub fn read_object_temperature(
&mut self,
calibration_factor: f64
) -> Result<f64, Error<E>>
Read the object temperature in Kelvins.
This uses the sensor voltage and ambient temperature as well as an input calibration factor.
The input calibration factor can be calculated with the formulas
provided in the [TMP006 user guide].
Typical values are between 5*10^-14
and 7*10^-14
sourcepub fn calculate_object_temperature(
&self,
data: SensorData,
calibration_factor: f64
) -> f64
pub fn calculate_object_temperature(
&self,
data: SensorData,
calibration_factor: f64
) -> f64
Calculate the object temperature in Kelvins.
Given the sensor data and a calibration factor.
The input calibration factor can be calculated with the formulas
provided in the [TMP006 user guide].
Typical values are between 5*10^-14
and 7*10^-14
sourcepub fn read_sensor_data(&mut self) -> Result<SensorData, Error<E>>
pub fn read_sensor_data(&mut self) -> Result<SensorData, Error<E>>
Read the data from the sensor.
These values can be used to calculate the object temperature as done in
read_object_temperature()
.
sourcepub fn is_data_ready(&mut self) -> Result<bool, Error<E>>
pub fn is_data_ready(&mut self) -> Result<bool, Error<E>>
Reads whether there is data ready to be read.
When this returens false
it means that a conversion is in progress.
sourcepub fn read_manufacturer_id(&mut self) -> Result<u16, Error<E>>
pub fn read_manufacturer_id(&mut self) -> Result<u16, Error<E>>
Read the manufacturer ID.
This is per default 0x5449
.
sourcepub fn read_device_id(&mut self) -> Result<u16, Error<E>>
pub fn read_device_id(&mut self) -> Result<u16, Error<E>>
Read the device ID.
This is per default 0x0067
.