Skip to content

Rust library for the calculation of resistance and temperature for platinum type RTDs, e.g. PT100.

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

thecodechemist99/pt-rtd

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pt-rtd

Latest Version Documentation License Dependency Status

Usage

Add this to your Cargo.toml:

[dependencies]
pt-rtd = "0.1"

Examples

Conversion of temperature and resistance values:

use pt_rtd::{
    self as rtd,
    RTDType,
};

fn main() -> ! {
    let resistance: f32 = 100.0;
    let temperature: f32 = 0.0;

    // Convert resistance to temperature
    let result = rtd::calc_t(resistance, RTDType::PT100);
    let t = match result {
        Ok(temp) => temp,
        Err(e) => // handle error
    }

    // Convert temperature to resistance
    let result = rtd::calc_r(temperature, RTDType::PT100);
    let r = match result {
        Ok(res) => res,
        Err(e) => // handle error
    }
}

For relative mesurements, the library can also convert the ADC reading to a resistance value:

use pt_rtd::{
    self as rtd,
    ADCRes,
};

fn main() -> ! {
    let adc_value: u32 = 1000;
    let adc_resolution = ADCRes::B24;
    let ref_resistance = 5600;
    let pga_gain = 16;

    let result = rtd::conv_d_val_to_r(adc_value, ref_resistance, adc_resolution, pga_gain);
    let r = match result {
        Ok(res) => res,
        Err(e) => // handle error
    }
}

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Rust library for the calculation of resistance and temperature for platinum type RTDs, e.g. PT100.

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Packages

No packages published

Languages