Available on crate feature
unstable only.Expand description
§Temperature Sensor (tsens)
§Overview
The Temperature Sensor peripheral is used to measure the internal temperature inside the chip. The voltage is internally converted via an ADC into a digital value, and has a measuring range of –40 °C to 125 °C. The temperature value depends on factors like microcontroller clock frequency or I/O load. Generally, the chip’s internal temperature is higher than the operating ambient temperature.
§Configuration
Config selects the clock source. Available sources depend on the chip;
see ClockSource.
§Examples
The following example will measure the internal chip temperature every second, and print it
let mut temperature_sensor = TemperatureSensor::new(peripherals.TSENS, Config::default())?;
let delay = Delay::new();
loop {
let temp = temperature_sensor.get_temperature();
println!("Temperature: {:.2}°C", temp.to_celsius());
delay.delay_millis(1_000);
}§Implementation State
- Temperature calibration range is not supported
- Interrupts are not supported
Structs§
- Config
- Temperature sensor configuration
- Temperature
- Stores the raw ADC value and can be used to calculate the temperature in Celsius using the
formula:
(raw_value * 0.4386) - (offset * 27.88) - 20.52. - Temperature
Sensor - Temperature sensor driver
Enums§
- Clock
Source - Clock source for the temperature sensor.
The list of clock signals that the
TSENS_SCLKmultiplexer can output. - Config
Error - Temperature sensor configuration error.