[−][src]Crate tsic
Allows to read the current temperature from the TSIC temperature sensors.
Note that most of this code is ported and heavily modified from C to rust using the code found in arduino-tsic and other places scattered throughout the internet that used the sensor from C.
Please also refer to the Data Sheet for implementation details.
Usage
Please see the comments on both the with_vdd_control
and without_vdd_control
constructors for
their usage and upsides/downsides.
If the library should control both the signal and the vdd pins (recommended):
use tsic::{SensorType, Tsic}; let sensor = Tsic::with_vdd_control(SensorType::Tsic306, /* your hal signal input pin */, /* your vdd output pin */); let mut delay = /* your hal delay */(); match sensor.read(&mut delay) { Ok(t) => defmt::info!("Temp is: {:f32}", t.as_celsius()), Err(e) => defmt::warn!("Getting sensor data failed: {:?}", e), };
If the library should just control the signal pin:
use tsic::{SensorType, Tsic}; let sensor = Tsic::without_vdd_control(SensorType::Tsic306, /* your hal signal input pin */); let mut delay = /* your hal delay */(); match sensor.read(&mut delay) { Ok(t) => defmt::info!("Temp is: {:f32}", t.as_celsius()), Err(e) => defmt::warn!("Getting sensor data failed: {:?}", e), };
Structs
DummyOutputPin | This |
Temperature | Represents a single temperature reading from the TSIC 306 sensor. |
Tsic | The |
Enums
SensorType | Refers to the sensor type that is used. |
TsicError | Contains all errors that can happen during a reading from the sensor. |