Skip to main content

temperature_register

Function temperature_register 

Source
pub fn temperature_register(milli_celsius: i32) -> u16
Expand description

Builds the temperature register the sensor reports for a temperature.

The inverse of milli_celsius. The result is a 14-bit code in bits 15:2 with the two reserved low bits clear, which is what the part sends, so a decode of the built register lands within one 14-bit step (about 0.01 °C) of the input. Inputs outside -40 to +125 °C clamp to the ends of the scale.

§Arguments

  • milli_celsius - the temperature in millidegrees Celsius.

§Returns

The 16-bit temperature register.