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§
- Alert
Mode - How the limits are applied (configuration bit 4, T/nA).
- Alert
Pin - What the ALERT pin reflects (configuration bit 2, DR/Alert).
- Alert
Polarity - The ALERT pin’s active level (configuration bit 3, POL).
- Averaging
- The number of conversions averaged into each result (configuration bits 6:5, AVG).
- Conversion
Cycle - The nominal conversion cycle in continuous mode (configuration bits 9:7, CONV).
- Conversion
Mode - 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.