Contiki 2.5
tmp102-sensor.h
1 /*
2  * An interface to the TI TMP102 temperature sensor
3  * 12 bit temperature reading, 0.5 deg. Celsius accuracy
4  * -----------------------------------------------------------------
5  *
6  * Author : Hedde Bosman (heddebosman@incas3.eu)
7  */
8 
9 #ifndef __TMP102_SENSOR_H__
10 #define __TMP102_SENSOR_H__
11 
12 #include "i2c.h"
13 
14 #include "lib/sensors.h"
15 
16 extern const struct sensors_sensor tmp102_sensor;
17 
18 #define TMP102_VALUE_TYPE_DEFAULT 0
19 
20 #define TMP102_ADDR 0x48 // if A0 @ ground
21 //#define TMP102_ADDR 0x49 // if A0 @ V+
22 //#define TMP102_ADDR 0x4A // if A0 @ SDA
23 //#define TMP102_ADDR 0x4B // if A0 @ SCL
24 
25 #define TMP102_REGISTER_TEMPERATURE 0x00
26 #define TMP102_REGISTER_CONFIGURATION 0x01
27 #define TMP102_REGISTERO_T_LOW 0x02
28 #define TMP102_REGISTERO_T_HIGH 0x03
29 
30 
31 #define TMP102_CONF_EXTENDED_MODE 0x10
32 #define TMP102_CONF_ALERT 0x20
33 #define TMP102_CONF_CONVERSION_RATE 0xC0 // 2 bits indicating conversion rate (0.25, 1, 4, 8 Hz)
34 
35 #define TMP102_CONF_SHUTDOWN_MODE 0x01
36 #define TMP102_CONF_THERMOSTAT_MODE 0x02 // 0 = comparator mode, 1 = interrupt mode
37 #define TMP102_CONF_POLARITY 0x04
38 #define TMP102_CONF_FAULT_QUEUE 0x18 // 2 bits indicating number of faults
39 #define TMP102_CONF_RESOLUTION 0x60 // 2 bits indicating resolution, default = b11 = 0x60
40 #define TMP102_CONF_ONESHOT_READY 0x80 //
41 
42 
43 #endif
44