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 #ifndef TMP006_CONVERSION_TIME
39 #define TMP006_CONVERSION_TIME 1E6
43 #define TMP006_SENSOR_VOLTAGE 0x00
44 #define TMP006_LOCAL_TEMPERATURE 0x01
45 #define TMP006_CONFIGURATION 0x02
46 #define TMP006_MANUFACTURER_ID_REG 0xFE
47 #define TMP006_DEVICE_ID_REG 0xFF
50 #define TMP006_RST_SOFT (1 << 15)
52 #define TMP006_CONFIG_MOD_SHIFT 12
53 #define TMP006_CONFIG_MOD_MASK 0x7000
54 #define TMP006_CONFIG_MOD(x) (((uint16_t)(((uint16_t)(x))<<\
55 TMP006_CONFIG_MOD_SHIFT))\
56 &TMP006_CONFIG_MOD_MASK)
57 #define TMP006_CONFIG_MOD_CC 0x07
58 #define TMP006_CONFIG_MOD_OFF 0x00
60 #define TMP006_CONFIG_CR_SHIFT 9
61 #define TMP006_CONFIG_CR_MASK 0x0E00
62 #define TMP006_CONFIG_CR(x) (((uint16_t)(((uint16_t)(x))<<\
63 TMP006_CONFIG_CR_SHIFT))\
64 &TMP006_CONFIG_CR_MASK)
65 #define TMP006_CONFIG_CR_AS1 0x00
66 #define TMP006_CONFIG_CR_AS2 0x01
67 #define TMP006_CONFIG_CR_AS4 0x02
68 #define TMP006_CONFIG_CR_AS8 0x03
69 #define TMP006_CONFIG_CR_AS16 0x04
70 #define TMP006_CONFIG_CR_DEF TMP006_CONFIG_CR_AS4
72 #define TMP006_DRDY_EN (1 << 8)
73 #define TMP006_DRDY_DATA_RDY (1 << 7)
76 #ifndef TMP006_CCONST_S0
77 #define TMP006_CCONST_S0 6.4E-14
80 #define TMP006_CCONST_A1 1.75E-3
81 #define TMP006_CCONST_A2 -1.678E-5
82 #define TMP006_CCONST_TREF 298.15
83 #define TMP006_CCONST_B0 -2.94E-5
84 #define TMP006_CCONST_B1 -5.7E-7
85 #define TMP006_CCONST_B2 4.63E-9
86 #define TMP006_CCONST_C2 13.4
87 #define TMP006_CCONST_LSB_SIZE 156.25E-9
134 TMP006 (
int bus, uint8_t conv_rate=TMP006_CONFIG_CR_DEF,
135 int devAddr=TMP006_I2C_ADDRESS);
175 void convert_data(int16_t rawv,int16_t rawt,
float *tamb,
float *tobj);
197 mraa::I2c m_i2ControlCtx;
199 int32_t m_temperature;
void resetSensor(void)
Definition: tmp006.cpp:105
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:161
float getTemperature(int bSampleData=0)
Definition: tmp006.cpp:226
int checkID(void)
Definition: tmp006.cpp:83
void setActive(void)
Definition: tmp006.cpp:121
API for the TMP006 IR-Thermopile Sensor.
Definition: tmp006.hpp:124
void setStandby(void)
Definition: tmp006.cpp:141
uint16_t getConfig(void)
Definition: tmp006.cpp:238
void convert_data(int16_t rawv, int16_t rawt, float *tamb, float *tobj)
Definition: tmp006.cpp:199