Skip to main content

Module tmp117

Module tmp117 

Source
Expand description

Texas Instruments TMP117 high-accuracy digital temperature sensor.

The TMP117 returns a 16-bit two’s-complement temperature at 7.8125 m°C per count, accurate to ±0.1 °C without calibration, and carries its own alert limits, a user offset, and a small EEPROM. This module decodes the temperature register, builds the same-format values the limit and offset registers take, and assembles or parses the configuration register field by field, following the datasheet’s register map, its 16-bit temperature data table, and its conversion cycle table.

Temperatures are returned in integer nano- and micro-degrees so the conversion stays in integer arithmetic; the f32 form is exact too, since one count is 1/128 °C.

Modules§

address
The four 7-bit bus addresses, selected by where the ADD0 pin is tied.
register
The TMP117 register addresses, written to the pointer register.

Structs§

Configuration
A decoded TMP117 configuration register.

Enums§

AlertMode
How the limits are applied (configuration bit 4, T/nA).
AlertPin
What the ALERT pin reflects (configuration bit 2, DR/Alert).
AlertPolarity
The ALERT pin’s active level (configuration bit 3, POL).
Averaging
The number of conversions averaged into each result (configuration bits 6:5, AVG).
ConversionCycle
The nominal conversion cycle in continuous mode (configuration bits 9:7, CONV).
ConversionMode
The conversion mode (configuration bits 11:10, MOD).

Constants§

CONFIG_RESET
The factory value of the configuration register (0x0220): continuous conversion, a 1 s cycle, 8 averaged conversions, alert mode, ALERT active low.
DEVICE_ID
The device ID field a TMP117 reports (bits 11:0 of the Device_ID register).
EEPROM_UNLOCK
Writing this to the EEPROM unlock register (bit 15, EUN) makes subsequent writes to the programmable registers persist in EEPROM.
GENERAL_CALL_RESET
The command byte that, sent after the general-call address 0x00, resets every register to its power-up value.
HIGH_LIMIT_RESET
The factory value of the high limit register (0x6000, 192 °C).
LOW_LIMIT_RESET
The factory value of the low limit register (0x8000, -256 °C).
TEMP_RESULT_RESET
The temperature register value after a reset (0x8000, -256 °C), held until the first conversion completes.

Functions§

celsius
Decodes a temperature, limit, or offset register to degrees Celsius.
data_ready
Returns whether the configuration register’s Data_Ready flag (bit 13) is set.
device_id
Returns the device ID field of a Device_ID register read (bits 11:0).
eeprom_busy
Returns whether the configuration register’s EEPROM_Busy flag (bit 12) is set.
eeprom_unlock_busy
Returns whether the EEPROM unlock register’s EEPROM_Busy flag (bit 14) is set.
high_alert
Returns whether the configuration register’s HIGH_Alert flag (bit 15) is set.
low_alert
Returns whether the configuration register’s LOW_Alert flag (bit 14) is set.
micro_celsius
Decodes a temperature, limit, or offset register to microdegrees Celsius.
nano_celsius
Decodes a temperature, limit, or offset register to nanodegrees Celsius.
raw_from_celsius
Builds the register value nearest a temperature in degrees Celsius.
raw_from_micro_celsius
Builds the register value nearest a temperature in microdegrees Celsius.
revision
Returns the revision field of a Device_ID register read (bits 15:12).
temperature_bytes
Splits a temperature-format register into the two bytes the bus carries.
temperature_from_bytes
Joins the two bytes read from a temperature-format register.