30 #include <mraa/i2c.hpp>
33 #define TMP006_NAME "TMP006"
34 #define TMP006_I2C_ADDRESS 0x41
35 #define TMP006_MANUFACTURER_ID 0x5449
36 #define TMP006_DEVICE_ID 0x0067
38 #define TMP007_I2C_ADDRESS 0x40
40 #define TMP007_DEVICE_ID 0x0078
42 #ifndef TMP006_CONVERSION_TIME
43 #define TMP006_CONVERSION_TIME 1E6
47 #define TMP006_SENSOR_VOLTAGE 0x00
48 #define TMP006_LOCAL_TEMPERATURE 0x01
49 #define TMP006_CONFIGURATION 0x02
50 #define TMP006_MANUFACTURER_ID_REG 0xFE
51 #define TMP006_DEVICE_ID_REG 0xFF
54 #define TMP007_DEVICE_ID_REG 0x1F
57 #define TMP006_RST_SOFT (1 << 15)
59 #define TMP006_CONFIG_MOD_SHIFT 12
60 #define TMP006_CONFIG_MOD_MASK 0x7000
61 #define TMP006_CONFIG_MOD(x) (((uint16_t)(((uint16_t)(x))<<\
62 TMP006_CONFIG_MOD_SHIFT))\
63 &TMP006_CONFIG_MOD_MASK)
64 #define TMP006_CONFIG_MOD_CC 0x07
65 #define TMP006_CONFIG_MOD_OFF 0x00
67 #define TMP006_CONFIG_CR_SHIFT 9
68 #define TMP006_CONFIG_CR_MASK 0x0E00
69 #define TMP006_CONFIG_CR(x) (((uint16_t)(((uint16_t)(x))<<\
70 TMP006_CONFIG_CR_SHIFT))\
71 &TMP006_CONFIG_CR_MASK)
72 #define TMP006_CONFIG_CR_AS1 0x00
73 #define TMP006_CONFIG_CR_AS2 0x01
74 #define TMP006_CONFIG_CR_AS4 0x02
75 #define TMP006_CONFIG_CR_AS8 0x03
76 #define TMP006_CONFIG_CR_AS16 0x04
77 #define TMP006_CONFIG_CR_DEF TMP006_CONFIG_CR_AS4
79 #define TMP006_DRDY_EN (1 << 8)
80 #define TMP006_DRDY_DATA_RDY (1 << 7)
83 #ifndef TMP006_CCONST_S0
84 #define TMP006_CCONST_S0 6.4E-14
87 #define TMP006_CCONST_A1 1.75E-3
88 #define TMP006_CCONST_A2 -1.678E-5
89 #define TMP006_CCONST_TREF 298.15
90 #define TMP006_CCONST_B0 -2.94E-5
91 #define TMP006_CCONST_B1 -5.7E-7
92 #define TMP006_CCONST_B2 4.63E-9
93 #define TMP006_CCONST_C2 13.4
94 #define TMP006_CCONST_LSB_SIZE 156.25E-9
145 TMP006 (
int bus, uint8_t conv_rate=TMP006_CONFIG_CR_DEF,
146 int devAddr=TMP006_I2C_ADDRESS);
186 void convert_data(int16_t rawv,int16_t rawt,
float *tamb,
float *tobj);
208 mraa::I2c m_i2ControlCtx;
211 int32_t m_temperature;
void resetSensor(void)
Definition: tmp006.cpp:133
TMP006(int bus, uint8_t conv_rate=TMP006_CONFIG_CR_DEF, int devAddr=TMP006_I2C_ADDRESS)
Definition: tmp006.cpp:39
int sampleData(void)
Definition: tmp006.cpp:189
float getTemperature(int bSampleData=0)
Definition: tmp006.cpp:256
int checkID(void)
Definition: tmp006.cpp:85
void setActive(void)
Definition: tmp006.cpp:149
API for the TMP006 IR-Thermopile Sensor.
Definition: tmp006.hpp:135
void setStandby(void)
Definition: tmp006.cpp:169
uint16_t getConfig(void)
Definition: tmp006.cpp:268
void convert_data(int16_t rawv, int16_t rawt, float *tamb, float *tobj)
Definition: tmp006.cpp:229