Contiki 2.6

tmp102-sensor.h

00001 /*
00002  * An interface to the TI TMP102 temperature sensor
00003  * 12 bit temperature reading, 0.5 deg. Celsius accuracy
00004  * -----------------------------------------------------------------
00005  *
00006  * Author  : Hedde Bosman (heddebosman@incas3.eu)
00007  */
00008 
00009 #ifndef __TMP102_SENSOR_H__
00010 #define __TMP102_SENSOR_H__
00011 
00012 #include "i2c.h"
00013 
00014 #include "lib/sensors.h"
00015 
00016 extern const struct sensors_sensor tmp102_sensor;
00017 
00018 #define TMP102_VALUE_TYPE_DEFAULT 0
00019 
00020 #define TMP102_ADDR                             0x48 // if A0 @ ground
00021 //#define TMP102_ADDR                           0x49 // if A0 @ V+
00022 //#define TMP102_ADDR                           0x4A // if A0 @ SDA
00023 //#define TMP102_ADDR                           0x4B // if A0 @ SCL
00024 
00025 #define TMP102_REGISTER_TEMPERATURE             0x00
00026 #define TMP102_REGISTER_CONFIGURATION   0x01
00027 #define TMP102_REGISTERO_T_LOW                  0x02
00028 #define TMP102_REGISTERO_T_HIGH                 0x03
00029 
00030 
00031 #define TMP102_CONF_EXTENDED_MODE               0x10
00032 #define TMP102_CONF_ALERT                               0x20
00033 #define TMP102_CONF_CONVERSION_RATE             0xC0 // 2 bits indicating conversion rate (0.25, 1, 4, 8 Hz)
00034 
00035 #define TMP102_CONF_SHUTDOWN_MODE               0x01
00036 #define TMP102_CONF_THERMOSTAT_MODE             0x02 // 0 = comparator mode, 1 = interrupt mode
00037 #define TMP102_CONF_POLARITY                    0x04
00038 #define TMP102_CONF_FAULT_QUEUE                 0x18 // 2 bits indicating number of faults
00039 #define TMP102_CONF_RESOLUTION                  0x60 // 2 bits indicating resolution, default = b11 = 0x60
00040 #define TMP102_CONF_ONESHOT_READY               0x80 // 
00041 
00042 
00043 #endif
00044