Struct anyleaf::rtd::Rtd [−][src]
pub struct Rtd<CS: OutputPin> { /* fields omitted */ }
Expand description
A struct used to describe the RTD. Owns the cs pin.
Implementations
pub fn new<SPI, E>(spi: &mut SPI, cs: CS, type_: RtdType, wires: Wires) -> Self where
SPI: Write<u8, Error = E> + Transfer<u8, Error = E>,
Updates the devices configuration.
Arguments
vbias
- Set totrue
to enable V_BIAS voltage, which is required to correctly perform conversion.Cloneconversion_mode
-true
to automatically perform conversion, otherwise normally off.one_shot
- Only perform detection once if set totrue
, otherwise repeats conversion.sensor_type
- Define whether a two, three or four wire sensor is used.Clonefilter_mode
- Specify the mains frequency that should be used to filter out noise, e.g. 50Hz in Europe.
Remarks
This will update the configuration register of the MAX31865 register. If the device doesn’t properly react
to this, add a delay after calling new
to increase the time that the chip select line is set high.
Note: The correct sensor configuration also requires changes to the PCB! Make sure to read the datasheet concerning this.
Read the raw RTD value.
Remarks
The raw value is the value of the combined MSB and LSB registers. The first 15 bits specify the ohmic value in relation to the reference resistor (i.e. 2^15 - 1 would be the exact same resistance as the reference resistor). See manual for further information. The last bit specifies if the conversion was successful.
Measure RTD resistance, in Ohms.
Measure temperature, in Celsius
Return the configuration register data.
Find the fault status. See Table 7.
todo: Sort this out.
Set the calibration reference resistance. This can be used to calibrate inaccuracies of both the reference resistor and the PT100 element.
Arguments
calib
- A 32 bit integer specifying the reference resistance in ohms multiplied by 100, e.g.40000
for 400 Ohms
Remarks
You can perform calibration by putting the sensor in boiling (100 degrees
Celcius) water and then measuring the raw value using read_raw
. Calculate
calib
as (13851 << 15) / raw >> 1
.