![]() |
![]() |
|
TI-OpenThread API Documentation
1.03.02.00
|
TMP007 driver.
============================================================================
The TMP007 header file should be included in an application as follows:
The TMP007 driver simplifies using a TMP007 sensor to perform temperature readings. The board's I2C peripheral and pins must be configured and then initialized by using Board_initI2C(). Similarly, any GPIO pins must be configured and then initialized by using Board_initGPIO(). A TMP007_config array should be defined by the application. The TMP007_config array should contain pointers to a defined TMP007_HWAttrs and allocated array for the TMP007_Object structures. TMP007_init() must be called prior to using TMP007_open().
The APIs in this driver serve as an interface to a DPL(Driver Porting Layer) The specific implementations are responsible for creating all the RTOS specific primitives to allow for thread-safe operation.
For accurate operation, calibration may be necessary. Refer to SBOU142.pdf for calibration instructions.
This driver has no dynamic memory allocation.
Each structure must be defined by the application. The following example is for a MSP432 in which two TMP007 sensors are setup. The following declarations are placed in "MSP_EXP432P401R.h" and "MSP_EXP432P401R.c" respectively. How the gpioIndices are defined are detailed in the next example.
"MSP_EXP432P401R.h"
"MSP_EXP432P401R.c"
The following example is for a MSP432 in which two TMP007 sensors each need a GPIO pin for alarming. The following definitions are in "MSP_EXP432P401R.h" and "MSP_EXP432P401R.c" respectively. This example uses GPIO pins 1.5 and 4.3. The GPIO_CallbackFxn table must contain as many indices as GPIO_CallbackFxns that will be specified by the application. For each ALERT pin used, an index should be allocated as NULL.
"MSP_EXP432P401R.h"
"MSP_EXP432P401R.c"
The I2C controller must be in blocking mode. This will seamlessly allow for multiple I2C endpoints without conflicting callback functions. The I2C_open() call requires a configured index. This index must be defined by the application in accordance to the I2C driver. The default transfer mode for an I2C_Params structure is I2C_MODE_BLOCKING. In the example below, the transfer mode is set explicitly for clarity. Additionally, the TMP007 hardware is capable of communicating at 400kHz. The default bit rate for an I2C_Params structure is I2C_100kHz.
The TMP007_open() call must be made in a task context.
In the following example, a callback function is specified in the tmp007Params structure. This indicates to the module that the ALERT pin will be used. Additionally, a user specific argument is passed in. The sensor will assert the ALERT pin whenever the temperature exceeds 35 (C). The low limit is ignored. No ALERT will be generated until TMP007_enableAlert() is called.
Go to the source code of this file.
Data Structures | |
| struct | TMP007_Config |
| TMP007 configuration. More... | |
| struct | TMP007_HWAttrs |
| Hardware specific settings for a TMP007 sensor. More... | |
| struct | TMP007_Object |
| Members should not be accessed by the application. More... | |
| struct | TMP007_Params |
| TMP007 Parameters. More... | |
Macros | |
| #define | TMP007_A0 0x000B /*! A0 coefficient register */ |
| #define | TMP007_A1 0x000C /*! A1 coefficient register */ |
| #define | TMP007_B0 0x000D /*! B0 coefficient register */ |
| #define | TMP007_B1 0x000E /*! B1 coefficient register */ |
| #define | TMP007_B2 0x000F /*! B2 coefficient register */ |
| #define | TMP007_C 0x0010 /*! C coefficient register */ |
| #define | TMP007_CONFIG 0x0002 /*! Configuration register */ |
| #define | TMP007_DEVICEID 0x001F /*! Manufacturer ID register */ |
| #define | TMP007_DIE_HI_LIM 0x0008 /*! DIE Temp High limit register */ |
| #define | TMP007_DIE_LO_LIM 0x0009 /*! DIE Temp Low limit register */ |
| #define | TMP007_DIE_TEMP 0x0001 /*! DIE Temp result register */ |
| #define | TMP007_IGNORE 0xFFFF |
| Ignore temperature limit define. More... | |
| #define | TMP007_MASK_ENABLE 0x0005 /*! Status Mask and Enable Register */ |
| #define | TMP007_MEMORY 0x002A /*! Memory access register */ |
| #define | TMP007_OBJ_HI_LIM 0x0006 /*! Object Temp High limit register */ |
| #define | TMP007_OBJ_LO_LIM 0x0007 /*! Object Temp Low limit register */ |
| #define | TMP007_OBJ_TEMP 0x0003 /*! Object Temp Result Register */ |
| #define | TMP007_S0 0x000A /*! S0 coefficient register */ |
| #define | TMP007_SMER_ALRTEN 0x8000 /*! Alert Flag Enable Bit */ |
| #define | TMP007_SMER_CRTEN 0x4000 /*! Tem Conversion Ready Enable */ |
| #define | TMP007_SMER_DVEN 0x0200 /*! Data Invalid Flag Enable Bit */ |
| #define | TMP007_SMER_LHEN 0x0800 /*! DIE Temp High Limit Enable */ |
| #define | TMP007_SMER_LLEN 0x0400 /*! DIE Temp Low Limit Enable */ |
| #define | TMP007_SMER_MEMC_EN 0x0100 /*! Memory Corrupt Enable Bit */ |
| #define | TMP007_SMER_OHEN 0x2000 /*! Object Temp High Limit Enable */ |
| #define | TMP007_SMER_OLEN 0x1000 /*! Object Temp Low Limit Enable */ |
| #define | TMP007_STAT_ALRTF 0x8000 /*! Cumulative Alert Flag */ |
| #define | TMP007_STAT_CRTF 0x4000 /*! Conversion Ready Flag */ |
| #define | TMP007_STAT_DOF 0x0080 /*! Data Overflow */ |
| #define | TMP007_STAT_LHF 0x0800 /*! Local Temp High Limit Flag */ |
| #define | TMP007_STAT_LLF 0x0400 /*! Local Temp Low Limit Flag */ |
| #define | TMP007_STAT_MCRPT 0x0100 /*! Memory Corrupt Flag */ |
| #define | TMP007_STAT_nDVF 0x0200 /*! Data Invalid Flag */ |
| #define | TMP007_STAT_OHF 0x2000 /*! Object Temp High Limit Flag */ |
| #define | TMP007_STAT_OLF 0x1000 /*! Object Temp Low Limit Flag */ |
| #define | TMP007_STATUS 0x0004 /*! Status register */ |
| #define | TMP007_TC0 0x0011 /*! TC0 coefficient register */ |
| #define | TMP007_TC1 0x0012 /*! TC1 coefficient register */ |
| #define | TMP007_VOBJ 0x0000 /*! Sensor voltage result register */ |
Typedefs | |
| typedef struct TMP007_Config | TMP007_Config |
| TMP007 configuration. More... | |
| typedef enum TMP007_Conversions | TMP007_Conversions |
| TMP007 ADC conversion settings. More... | |
| typedef struct TMP007_Config * | TMP007_Handle |
| A handle that is returned from a TMP007_open() call. More... | |
| typedef struct TMP007_HWAttrs | TMP007_HWAttrs |
| Hardware specific settings for a TMP007 sensor. More... | |
| typedef enum TMP007_IntComp | TMP007_IntComp |
| TMP007 interrupt/comparator settings. More... | |
| typedef struct TMP007_Object | TMP007_Object |
| Members should not be accessed by the application. More... | |
| typedef struct TMP007_Params | TMP007_Params |
| TMP007 Parameters. More... | |
| typedef enum TMP007_SlaveAddress | TMP007_SlaveAddress |
| TMP007 I2C slave addresses. More... | |
| typedef enum TMP007_TempScale | TMP007_TempScale |
| TMP007 temperature settings. More... | |
| typedef enum TMP007_TransientCorrect | TMP007_TransientCorrect |
| TMP007 Transient Correct settings. More... | |
Enumerations | |
| enum | TMP007_Conversions { TMP007_1CONV = 0x0000, TMP007_2CONV = 0x0200, TMP007_4CONV = 0x0400, TMP007_8CONV = 0x0600, TMP007_16CONV = 0x0800, TMP007_1CONVLP = 0x0A00, TMP007_2CONVLP = 0x0C00, TMP007_4CONVLP = 0x0E00 } |
| TMP007 ADC conversion settings. More... | |
| enum | TMP007_IntComp { TMP007_IntMode = 0, TMP007_CompMode = 0x0020 } |
| TMP007 interrupt/comparator settings. More... | |
| enum | TMP007_SlaveAddress { TMP007_SA1 = 0x40, TMP007_SA2 = 0x41, TMP007_SA3 = 0x42, TMP007_SA4 = 0x43, TMP007_SA5 = 0x44, TMP007_SA6 = 0x45, TMP007_SA7 = 0x46, TMP007_SA8 = 0x47 } |
| TMP007 I2C slave addresses. More... | |
| enum | TMP007_TempScale { TMP007_CELSIUS = 0, TMP007_KELVIN = 1, TMP007_FAHREN = 2 } |
| TMP007 temperature settings. More... | |
| enum | TMP007_TransientCorrect { TMP007_TCDisable = 0, TMP007_TCEnable = 0x0040 } |
| TMP007 Transient Correct settings. More... | |
Functions | |
| bool | TMP007_close (TMP007_Handle handle) |
| Function to close a TMP007 sensor specified by the TMP007 handle. More... | |
| bool | TMP007_disableAlert (TMP007_Handle handle) |
| Function to disable the ALERT pin and GPIO interrupt. More... | |
| bool | TMP007_disableConversions (TMP007_Handle handle) |
| Function to put TMP007 sensor is low power state. More... | |
| bool | TMP007_enableAlert (TMP007_Handle handle) |
| Function to enable the ALERT pin and GPIO interrupt. More... | |
| bool | TMP007_enableConversions (TMP007_Handle handle) |
| Function to restore TMP007 to normal power operation. More... | |
| static bool | TMP007_getDieTemp (TMP007_Handle handle, TMP007_TempScale scale, float *temp) |
| Function to read die temperature. More... | |
| static bool | TMP007_getDieTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float *high, float *low) |
| This function will read the die temperature limits. More... | |
| static bool | TMP007_getObjTemp (TMP007_Handle handle, TMP007_TempScale scale, float *temp) |
| Function to read object temperature. More... | |
| static bool | TMP007_getObjTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float *high, float *low) |
| This function will read the object temperature limits. More... | |
| bool | TMP007_getTemp (TMP007_Handle, TMP007_TempScale unit, float *data, uint16_t registerAddress) |
| bool | TMP007_getTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float *data, uint16_t registerAddress) |
| void | TMP007_init () |
| Function to initialize TMP007 driver. More... | |
| TMP007_Handle | TMP007_open (unsigned int tmp007Index, I2C_Handle i2cHandle, TMP007_Params *params) |
| Function to open a given TMP007 sensor. More... | |
| void | TMP007_Params_init (TMP007_Params *params) |
| Function to initialize a TMP007_Params struct to its defaults. More... | |
| bool | TMP007_readRegister (TMP007_Handle handle, uint16_t *data, uint8_t registerAddress) |
| Read function for advanced users. More... | |
| static bool | TMP007_readStatus (TMP007_Handle handle, uint16_t *data) |
| Function to read a TMP007 sensor's status register. More... | |
| static bool | TMP007_readVoltage (TMP007_Handle handle, int16_t *data) |
| Function to read a TMP007 sensor's voltage register. More... | |
| static bool | TMP007_setDieTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float high, float low) |
| This function will set the die temperature limits. More... | |
| static bool | TMP007_setObjTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float high, float low) |
| This function will set the object temperature limits. More... | |
| bool | TMP007_setTempLimit (TMP007_Handle handle, TMP007_TempScale scale, float data, uint16_t bitMask, uint8_t registerAddress) |
| bool | TMP007_writeRegister (TMP007_Handle handle, uint16_t data, uint8_t registerAddress) |
| Write function for advanced users. This is not thread safe. More... | |
| #define TMP007_A0 0x000B /*! A0 coefficient register */ |
| #define TMP007_A1 0x000C /*! A1 coefficient register */ |
| #define TMP007_B0 0x000D /*! B0 coefficient register */ |
| #define TMP007_B1 0x000E /*! B1 coefficient register */ |
| #define TMP007_B2 0x000F /*! B2 coefficient register */ |
| #define TMP007_C 0x0010 /*! C coefficient register */ |
| #define TMP007_CONFIG 0x0002 /*! Configuration register */ |
Referenced by TMP007_disableAlert(), TMP007_disableConversions(), TMP007_enableAlert(), TMP007_enableConversions(), and TMP007_open().
| #define TMP007_DEVICEID 0x001F /*! Manufacturer ID register */ |
| #define TMP007_DIE_HI_LIM 0x0008 /*! DIE Temp High limit register */ |
Referenced by TMP007_getDieTempLimit(), and TMP007_setDieTempLimit().
| #define TMP007_DIE_LO_LIM 0x0009 /*! DIE Temp Low limit register */ |
Referenced by TMP007_getDieTempLimit(), and TMP007_setDieTempLimit().
| #define TMP007_DIE_TEMP 0x0001 /*! DIE Temp result register */ |
Referenced by TMP007_getDieTemp().
| #define TMP007_IGNORE 0xFFFF |
Ignore temperature limit define.
TMP007_IGNORE should be used to ignore or unset a temperature limit.
In the following example, the object temperature limits are set and reset:
Referenced by TMP007_setTempLimit().
| #define TMP007_MASK_ENABLE 0x0005 /*! Status Mask and Enable Register */ |
Referenced by TMP007_setTempLimit().
| #define TMP007_MEMORY 0x002A /*! Memory access register */ |
| #define TMP007_OBJ_HI_LIM 0x0006 /*! Object Temp High limit register */ |
Referenced by TMP007_getObjTempLimit(), and TMP007_setObjTempLimit().
| #define TMP007_OBJ_LO_LIM 0x0007 /*! Object Temp Low limit register */ |
Referenced by TMP007_getObjTempLimit(), and TMP007_setObjTempLimit().
| #define TMP007_OBJ_TEMP 0x0003 /*! Object Temp Result Register */ |
Referenced by TMP007_getObjTemp().
| #define TMP007_S0 0x000A /*! S0 coefficient register */ |
| #define TMP007_SMER_ALRTEN 0x8000 /*! Alert Flag Enable Bit */ |
| #define TMP007_SMER_CRTEN 0x4000 /*! Tem Conversion Ready Enable */ |
| #define TMP007_SMER_DVEN 0x0200 /*! Data Invalid Flag Enable Bit */ |
| #define TMP007_SMER_LHEN 0x0800 /*! DIE Temp High Limit Enable */ |
Referenced by TMP007_setDieTempLimit().
| #define TMP007_SMER_LLEN 0x0400 /*! DIE Temp Low Limit Enable */ |
Referenced by TMP007_setDieTempLimit().
| #define TMP007_SMER_MEMC_EN 0x0100 /*! Memory Corrupt Enable Bit */ |
| #define TMP007_SMER_OHEN 0x2000 /*! Object Temp High Limit Enable */ |
Referenced by TMP007_setObjTempLimit().
| #define TMP007_SMER_OLEN 0x1000 /*! Object Temp Low Limit Enable */ |
Referenced by TMP007_setObjTempLimit().
| #define TMP007_STAT_ALRTF 0x8000 /*! Cumulative Alert Flag */ |
| #define TMP007_STAT_CRTF 0x4000 /*! Conversion Ready Flag */ |
| #define TMP007_STAT_DOF 0x0080 /*! Data Overflow */ |
| #define TMP007_STAT_LHF 0x0800 /*! Local Temp High Limit Flag */ |
| #define TMP007_STAT_LLF 0x0400 /*! Local Temp Low Limit Flag */ |
| #define TMP007_STAT_MCRPT 0x0100 /*! Memory Corrupt Flag */ |
| #define TMP007_STAT_nDVF 0x0200 /*! Data Invalid Flag */ |
| #define TMP007_STAT_OHF 0x2000 /*! Object Temp High Limit Flag */ |
| #define TMP007_STAT_OLF 0x1000 /*! Object Temp Low Limit Flag */ |
| #define TMP007_STATUS 0x0004 /*! Status register */ |
Referenced by TMP007_readStatus().
| #define TMP007_TC0 0x0011 /*! TC0 coefficient register */ |
| #define TMP007_TC1 0x0012 /*! TC1 coefficient register */ |
| #define TMP007_VOBJ 0x0000 /*! Sensor voltage result register */ |
Referenced by TMP007_readVoltage().
| typedef struct TMP007_Config TMP007_Config |
TMP007 configuration.
The TMP007_Config structure contains a set of pointers used to characterize the TMP007 driver implementation.
This structure needs to be defined and provided by the application.
| typedef enum TMP007_Conversions TMP007_Conversions |
TMP007 ADC conversion settings.
This enumeration defines the number of ADC conversions performed before an average is computed and stored in the hardware registers. More ADC conversions results in a longer overall conversion time and more accurate object temperature reading.
| typedef struct TMP007_Config* TMP007_Handle |
A handle that is returned from a TMP007_open() call.
| typedef struct TMP007_HWAttrs TMP007_HWAttrs |
Hardware specific settings for a TMP007 sensor.
This structure should be defined and provided by the application. The gpioIndex should be defined in accordance of the GPIO driver. The pin must be configured as GPIO_CFG_INPUT and GPIO_CFG_IN_INT_FALLING.
| typedef enum TMP007_IntComp TMP007_IntComp |
TMP007 interrupt/comparator settings.
The INT/COMP bit controls whether the limit flags are in INTERRUPT (INT) mode (0) or COMPARATOR (COMP) Mode (1). It controls the behavior of the limit flags (LH, LL, OH, OL) and the data invalid flag (nDVF) from the status register. In INT mode, the ALERT condition is maintained until the status register has been read. In COMP mode, the ALERT pin is asserted whenever the alert condition occurs, and deasserts without any external intervention when the alert condition is no longer present.
| typedef struct TMP007_Object TMP007_Object |
Members should not be accessed by the application.
| typedef struct TMP007_Params TMP007_Params |
TMP007 Parameters.
TMP007 parameters are used with the TMP007_open() call. Default values for these parameters are set using TMP007_Params_init(). The GPIO_CallbackFxn should be defined by the application only if the ALERT functionality is desired. A gpioIndex must be defined in the TMP007_HWAttrs for the corresponding tmp007Index. The GPIO_CallbackFxn is in the context of an interrupt handler.
| typedef enum TMP007_SlaveAddress TMP007_SlaveAddress |
TMP007 I2C slave addresses.
The TMP007 Slave Address is determined by the input to the ADR0 and ADR1 input pins of the TMP007 hardware. A '1' indicates a supply voltage of up to 7.5 V while '0' indicates ground. In some cases, the ADR0 pin may be coupled with the SDA or SCL bus to achieve a particular slave address. TMP007 sensors on the same I2C bus cannot share the same slave address.
| typedef enum TMP007_TempScale TMP007_TempScale |
TMP007 temperature settings.
This enumeration defines the scaling for reading and writing temperature values with a TMP007 sensor.
| typedef enum TMP007_TransientCorrect TMP007_TransientCorrect |
TMP007 Transient Correct settings.
Setting this bit turns on the transient correction–enabling sensor voltage and object temperature output filtering. This helps reduce error due to changes in the die temperature. As a general guideline, turn on transient correction when the die temperature is changing at a rate greater than 1.5 degrees (C) per minute. Transient correction corrects transients up to approximately 20 degrees (C) per minute.
| enum TMP007_Conversions |
TMP007 ADC conversion settings.
This enumeration defines the number of ADC conversions performed before an average is computed and stored in the hardware registers. More ADC conversions results in a longer overall conversion time and more accurate object temperature reading.
| enum TMP007_IntComp |
TMP007 interrupt/comparator settings.
The INT/COMP bit controls whether the limit flags are in INTERRUPT (INT) mode (0) or COMPARATOR (COMP) Mode (1). It controls the behavior of the limit flags (LH, LL, OH, OL) and the data invalid flag (nDVF) from the status register. In INT mode, the ALERT condition is maintained until the status register has been read. In COMP mode, the ALERT pin is asserted whenever the alert condition occurs, and deasserts without any external intervention when the alert condition is no longer present.
| Enumerator | |
|---|---|
| TMP007_IntMode | |
| TMP007_CompMode | |
| enum TMP007_SlaveAddress |
TMP007 I2C slave addresses.
The TMP007 Slave Address is determined by the input to the ADR0 and ADR1 input pins of the TMP007 hardware. A '1' indicates a supply voltage of up to 7.5 V while '0' indicates ground. In some cases, the ADR0 pin may be coupled with the SDA or SCL bus to achieve a particular slave address. TMP007 sensors on the same I2C bus cannot share the same slave address.
| enum TMP007_TempScale |
TMP007 Transient Correct settings.
Setting this bit turns on the transient correction–enabling sensor voltage and object temperature output filtering. This helps reduce error due to changes in the die temperature. As a general guideline, turn on transient correction when the die temperature is changing at a rate greater than 1.5 degrees (C) per minute. Transient correction corrects transients up to approximately 20 degrees (C) per minute.
| Enumerator | |
|---|---|
| TMP007_TCDisable | |
| TMP007_TCEnable | |
| bool TMP007_close | ( | TMP007_Handle | handle | ) |
Function to close a TMP007 sensor specified by the TMP007 handle.
The TMP007 hardware will be placed in a low power state in which ADC conversions are disabled. If the pin is configured to alarm, the ALERT pin and GPIO pin interrupts will be disabled. The I2C handle is not affected.
| handle | A TMP007_Handle returned from TMP007_open() |
References TMP007_Object::callback, TMP007_Object::i2cHandle, TMP007_Config::object, TMP007_disableAlert(), and TMP007_disableConversions().
| bool TMP007_disableAlert | ( | TMP007_Handle | handle | ) |
Function to disable the ALERT pin and GPIO interrupt.
This function will disable the ALERT pin on the specified TMP007 sensor. Interrupts on the TMP007 specific GPIO index will be disabled. Any temperature limits set are not affected. This function is not thread safe when used in conjunction with TMP007_enableAlert() (ie. A task is executing TMP007_disableAlert() but preempted by a higher priority task that calls TMP007_enableAlert() on the same handle).
| handle | A TMP007_Handle |
References CFG_ALRT, TMP007_Config::hwAttrs, TMP007_Config::object, TMP007_CONFIG, TMP007_readRegister(), and TMP007_writeRegister().
Referenced by TMP007_close().
| bool TMP007_disableConversions | ( | TMP007_Handle | handle | ) |
Function to put TMP007 sensor is low power state.
This function will place the specified TMP007 sensor in a low power state. All settings are retained. Temperature and voltage readings are invalid in this state. This function is not thread safe when used in conjunction with TMP007_enableConversions().
| handle | A TMP007_Handle |
References CFG_CONV_ON, TMP007_CONFIG, TMP007_readRegister(), and TMP007_writeRegister().
Referenced by TMP007_close().
| bool TMP007_enableAlert | ( | TMP007_Handle | handle | ) |
Function to enable the ALERT pin and GPIO interrupt.
This function will enable the ALERT pin on the specified TMP007 sensor. Interrupts on the TMP007 specific GPIO index will be disabled. This function is not thread safe when used in conjunction with TMP007_disableAlert() (ie. A task is executing TMP007_enableAlert() but preempted by a higher priority task that calls TMP007_disableAlert() on the same handle).
| handle | A TMP007_Handle |
References CFG_ALRT, TMP007_Config::hwAttrs, TMP007_Config::object, TMP007_CONFIG, TMP007_readRegister(), and TMP007_writeRegister().
| bool TMP007_enableConversions | ( | TMP007_Handle | handle | ) |
Function to restore TMP007 to normal power operation.
This function will restore ADC conversions on the specified TMP007 sensor. Temperature and voltage readings may be invalid up to 4 seconds following this function call. This function is not thread safe when used in conjunction with TMP007_disableConversions().
| handle | A TMP007_Handle |
References CFG_CONV_ON, TMP007_CONFIG, TMP007_readRegister(), and TMP007_writeRegister().
|
inlinestatic |
Function to read die temperature.
This function will return the temperature of the die. Full scale allows a result of up to (+/-)256 (C).
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature format. |
| temp | A pointer to a float in which temperature data will be stored in. |
References TMP007_DIE_TEMP, and TMP007_getTemp().
|
inlinestatic |
This function will read the die temperature limits.
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature return format. |
| high | A pointer to a float to store the value of the high temperature limit. |
| low | A pointer to a float to store the value of the low temperature limit. |
References TMP007_DIE_HI_LIM, TMP007_DIE_LO_LIM, and TMP007_getTempLimit().
|
inlinestatic |
Function to read object temperature.
This function will return the temperature of the object in the field of view of the specified TMP007 sensor. Full scale allows a result of up to (+/-)256 (C).
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature format. |
| temp | A pointer to a float in which temperature data will be stored in. |
References TMP007_getTemp(), and TMP007_OBJ_TEMP.
Referenced by coapHandleIrTemp().
|
inlinestatic |
This function will read the object temperature limits.
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature return format. |
| high | A pointer to a float to store the value of the high temperature limit. |
| low | A pointer to a float to store the value of the low temperature limit. |
References i2cHandle, TMP007_getTempLimit(), TMP007_init(), TMP007_OBJ_HI_LIM, TMP007_OBJ_LO_LIM, TMP007_open(), TMP007_Params_init(), and TMP007_readRegister().
| bool TMP007_getTemp | ( | TMP007_Handle | , |
| TMP007_TempScale | unit, | ||
| float * | data, | ||
| uint16_t | registerAddress | ||
| ) |
References CELSIUS_FAHREN_ADD, CELSIUS_FAHREN_CONST, CELSIUS_PER_LSB, CELSIUS_TO_KELVIN, TMP007_FAHREN, TMP007_KELVIN, and TMP007_readRegister().
Referenced by TMP007_getDieTemp(), and TMP007_getObjTemp().
| bool TMP007_getTempLimit | ( | TMP007_Handle | handle, |
| TMP007_TempScale | scale, | ||
| float * | data, | ||
| uint16_t | registerAddress | ||
| ) |
References CELSIUS_FAHREN_ADD, CELSIUS_FAHREN_CONST, CELSIUS_TO_KELVIN, TMP007_FAHREN, TMP007_KELVIN, and TMP007_readRegister().
Referenced by TMP007_getDieTempLimit(), and TMP007_getObjTempLimit().
| void TMP007_init | ( | ) |
Function to initialize TMP007 driver.
This function will initialize the TMP007 driver. This should be called before BIOS_start().
References i2cHandle, and TMP007_Config::object.
Referenced by initTMP(), and TMP007_getObjTempLimit().
| TMP007_Handle TMP007_open | ( | unsigned int | tmp007Index, |
| I2C_Handle | i2cHandle, | ||
| TMP007_Params * | params | ||
| ) |
Function to open a given TMP007 sensor.
Function to initialize a given TMP007 sensor specified by the particular index value. This function must be called from a task context. If one intends to use the ALERT pin, a callBack function must be specified in the TMP007_Params structure. Additionally, a gpioIndex must be setup and specified in the TMP007_HWAttrs structure.
The I2C controller must be operating in BLOCKING mode. Failure to ensure the I2C_Handle is in BLOCKING mode will result in undefined behavior.
The user should ensure that each sensor has its own slaveAddress, gpioIndex (if alarming) and tmp007Index.
| tmp007Index | Logical sensor number for the TMP007 indexed into the TMP007_config table |
| i2cHandle | An I2C_Handle opened in BLOCKING mode |
| *params | A pointer to TMP007_Params structure. If NULL, it will use default values. |
References TMP007_Object::callback, TMP007_Params::callback, CFG_CONV_ON, CFG_SW_RST, TMP007_Params::conversions, TMP007_HWAttrs::gpioIndex, i2cHandle, TMP007_Object::i2cHandle, TMP007_Params::intComp, TMP007_CONFIG, TMP007_writeRegister(), TMP007_Params::transientCorrect, and WAIT_POST_RESET.
Referenced by initTMP(), and TMP007_getObjTempLimit().
| void TMP007_Params_init | ( | TMP007_Params * | params | ) |
Function to initialize a TMP007_Params struct to its defaults.
| params | A pointer to TMP007_Params structure for initialization. |
Default values are: conversions = TMP007_4CONV intComp = TMP007_IntMode transientCorrect = TMP007_TCEnable callback = NULL
References TMP007_defaultParams.
Referenced by initTMP(), and TMP007_getObjTempLimit().
| bool TMP007_readRegister | ( | TMP007_Handle | handle, |
| uint16_t * | data, | ||
| uint8_t | registerAddress | ||
| ) |
Read function for advanced users.
| handle | A TMP007_Handle |
| registerAddress | Register address |
| data | A pointer to a data register in which received data will be written to. Must be 16 bits. |
References TMP007_Config::hwAttrs, i2cTransferFxn(), TMP007_Config::object, and READ_BUF_SIZE.
Referenced by TMP007_disableAlert(), TMP007_disableConversions(), TMP007_enableAlert(), TMP007_enableConversions(), TMP007_getObjTempLimit(), TMP007_getTemp(), TMP007_getTempLimit(), TMP007_readStatus(), TMP007_readVoltage(), and TMP007_setTempLimit().
|
inlinestatic |
Function to read a TMP007 sensor's status register.
| handle | A TMP007_Handle |
| data | A pointer to an uint16_t data buffer in which received data will be written. |
References TMP007_readRegister(), and TMP007_STATUS.
|
inlinestatic |
Function to read a TMP007 sensor's voltage register.
This function will read the sensor voltage register. This value is the digitized infrared sensor voltage output. The recieved data has a resolution of 156.25 nV/LSB and should be scaled appropriately.
| handle | A TMP007_Handle |
| data | A uint16_t pointer to a storage address. This value may range from (+/-) 5.21 mV. |
References TMP007_readRegister(), TMP007_setTempLimit(), and TMP007_VOBJ.
|
inlinestatic |
This function will set the die temperature limits.
This function will write the specified high and low die limits to the specified TMP007 sensor. The low limit will only flag when INT mode is enabled. In COMP mode, the low limit flag will always read 0 and therefore there will never be an ALERT generated on a low temperature limit. This function may be called multiple times to adjust or disable the limits.
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature return format. |
| high | A float that specifies the high limit. This value is limited to (+/-) 256 (C) with 0.5 (C) precision. Use TMP007_IGNORE as an argument if a high limit is not desired. |
| low | A float that specifies the low limit. This value is limited to (+/-) 256 (C) with 0.5 (C) precision. Use TMP007_IGNORE as an argument if a low limit is not desired. |
References TMP007_DIE_HI_LIM, TMP007_DIE_LO_LIM, TMP007_setTempLimit(), TMP007_SMER_LHEN, and TMP007_SMER_LLEN.
|
inlinestatic |
This function will set the object temperature limits.
This function will write the specified high and low object limits to the specified TMP007 sensor. The low limit will only flag when INT mode is enabled. In COMP mode, the low limit will always read 0. This function may be called multiple times to adjust or disable the limits.
| handle | A TMP007_Handle |
| scale | A TMP007_TempScale field specifying the temperature return format. |
| high | A float that specifies the high limit. This value is limited to (+/-) 256 (C) with 0.5 (C) precision. Use TMP007_IGNORE as an argument if a high limit is not desired. |
| low | A float that specifies the low limit. This value is limited to (+/-) 256 (C) with 0.5 (C) precision. Use TMP007_IGNORE as an argument if a low limit is not desired. |
References TMP007_OBJ_HI_LIM, TMP007_OBJ_LO_LIM, TMP007_setTempLimit(), TMP007_SMER_OHEN, TMP007_SMER_OLEN, and TMP007_writeRegister().
| bool TMP007_setTempLimit | ( | TMP007_Handle | handle, |
| TMP007_TempScale | scale, | ||
| float | data, | ||
| uint16_t | bitMask, | ||
| uint8_t | registerAddress | ||
| ) |
References CELSIUS_FAHREN_ADD, CELSIUS_FAHREN_CONST, CELSIUS_TO_KELVIN, MAX_CELSIUS, MIN_CELSIUS, TMP007_FAHREN, TMP007_IGNORE, TMP007_KELVIN, TMP007_MASK_ENABLE, TMP007_readRegister(), and TMP007_writeRegister().
Referenced by TMP007_readVoltage(), TMP007_setDieTempLimit(), and TMP007_setObjTempLimit().
| bool TMP007_writeRegister | ( | TMP007_Handle | handle, |
| uint16_t | data, | ||
| uint8_t | registerAddress | ||
| ) |
Write function for advanced users. This is not thread safe.
When writing to a handle, it is possible to overwrite data written by another task.
For example: Task A and B are writing to the configuration register. Task A has a higher priority than Task B. Task B is running and reads the configuration register. Task A then preempts Task B and reads the configuration register, performs a logical OR and writes to the configuration register. Task B then resumes execution and performs its logical OR and writes to the configuration register–overwriting the data written by Task A.
Such instances can be prevented through the use of Semaphores. Below is an example which utilizes an initialized Semaphore_handle, tmp007Lock.
| handle | A TMP007_Handle |
| data | A uint16_t containing the 2 bytes to be written to the TMP007 sensor. |
| registerAddress | Register address. |
References TMP007_Config::hwAttrs, i2cTransferFxn(), TMP007_Config::object, and WRITE_BUF_SIZE.
Referenced by TMP007_disableAlert(), TMP007_disableConversions(), TMP007_enableAlert(), TMP007_enableConversions(), TMP007_open(), TMP007_setObjTempLimit(), and TMP007_setTempLimit().