osd-contiki/platform/redbee-econotag/dev/tmp102-sensor.h
Mariano Alvira 697af5ef08 adding tmp102 sensor for the econotag from Hedde Bosman.
This can be pulling in as a common driver if we can make a generic i2c
Contiki driver.
2011-07-18 07:30:49 -04:00

45 lines
1.3 KiB
C

/*
* An interface to the TI TMP102 temperature sensor
* 12 bit temperature reading, 0.5 deg. Celsius accuracy
* -----------------------------------------------------------------
*
* Author : Hedde Bosman (heddebosman@incas3.eu)
*/
#ifndef __TMP102_SENSOR_H__
#define __TMP102_SENSOR_H__
#include "i2c.h"
#include "lib/sensors.h"
extern const struct sensors_sensor tmp102_sensor;
#define TMP102_VALUE_TYPE_DEFAULT 0
#define TMP102_ADDR 0x48 // if A0 @ ground
//#define TMP102_ADDR 0x49 // if A0 @ V+
//#define TMP102_ADDR 0x4A // if A0 @ SDA
//#define TMP102_ADDR 0x4B // if A0 @ SCL
#define TMP102_REGISTER_TEMPERATURE 0x00
#define TMP102_REGISTER_CONFIGURATION 0x01
#define TMP102_REGISTERO_T_LOW 0x02
#define TMP102_REGISTERO_T_HIGH 0x03
#define TMP102_CONF_EXTENDED_MODE 0x10
#define TMP102_CONF_ALERT 0x20
#define TMP102_CONF_CONVERSION_RATE 0xC0 // 2 bits indicating conversion rate (0.25, 1, 4, 8 Hz)
#define TMP102_CONF_SHUTDOWN_MODE 0x01
#define TMP102_CONF_THERMOSTAT_MODE 0x02 // 0 = comparator mode, 1 = interrupt mode
#define TMP102_CONF_POLARITY 0x04
#define TMP102_CONF_FAULT_QUEUE 0x18 // 2 bits indicating number of faults
#define TMP102_CONF_RESOLUTION 0x60 // 2 bits indicating resolution, default = b11 = 0x60
#define TMP102_CONF_ONESHOT_READY 0x80 //
#endif