tmp006.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 PHYTEC Messtechnik GmbH
3  * 2017 HAW Hamburg
4  *
5  * This file is subject to the terms and conditions of the GNU Lesser
6  * General Public License v2.1. See the file LICENSE in the top level
7  * directory for more details.
8  */
9 
77 #ifndef TMP006_H
78 #define TMP006_H
79 
80 #include <stdint.h>
81 #include <stdbool.h>
82 #include "periph/i2c.h"
83 
84 #ifdef __cplusplus
85 extern "C"
86 {
87 #endif
88 
92 #ifndef TMP006_I2C_ADDRESS
93 #define TMP006_I2C_ADDRESS (0x41)
94 #endif
95 
99 #ifndef TMP006_CONVERSION_TIME
100 #define TMP006_CONVERSION_TIME (1E6)
101 #endif
102 
107 #define TMP006_CONFIG_CR_AS1 (0x00)
108 #define TMP006_CONFIG_CR_AS2 (0x01)
109 #define TMP006_CONFIG_CR_AS4 (0x02)
110 #define TMP006_CONFIG_CR_AS8 (0x03)
111 #define TMP006_CONFIG_CR_AS16 (0x04)
112 #define TMP006_CONFIG_CR_DEF TMP006_CONFIG_CR_AS4
119 #ifndef TMP006_CCONST_S0
120 #define TMP006_CCONST_S0 (6.4E-14)
121 #endif
122 #define TMP006_CCONST_A1 (1.75E-3)
123 #define TMP006_CCONST_A2 (-1.678E-5)
124 #define TMP006_CCONST_TREF (298.15)
125 #define TMP006_CCONST_B0 (-2.94E-5)
126 #define TMP006_CCONST_B1 (-5.7E-7)
127 #define TMP006_CCONST_B2 (4.63E-9)
128 #define TMP006_CCONST_C2 (13.4)
129 #define TMP006_CCONST_LSB_SIZE (156.25E-9)
135 typedef struct {
137  uint8_t addr;
138  uint8_t rate;
140 
144 typedef struct {
146 } tmp006_t;
147 
151 enum {
157 };
158 
170 int tmp006_init(tmp006_t *dev, const tmp006_params_t *params);
171 
180 int tmp006_reset(const tmp006_t *dev);
181 
190 int tmp006_set_active(const tmp006_t *dev);
191 
200 int tmp006_set_standby(const tmp006_t *dev);
201 
213 int tmp006_read(const tmp006_t *dev, int16_t *rawv, int16_t *rawt, uint8_t *drdy);
214 
223 void tmp006_convert(int16_t rawv, int16_t rawt, float *tamb, float *tobj);
224 
234 int tmp006_read_temperature(const tmp006_t *dev, int16_t *ta, int16_t *to);
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif /* TMP006_H */
241 
internal device error
Definition: tmp006.h:154
Parameters needed for device initialization.
Definition: tmp006.h:135
i2c_t i2c
I2C device, the sensor is connected to.
Definition: tmp006.h:136
int tmp006_set_standby(const tmp006_t *dev)
Set standby mode.
uint8_t addr
the sensor&#39;s slave address on the I2C bus
Definition: tmp006.h:137
int tmp006_read(const tmp006_t *dev, int16_t *rawv, int16_t *rawt, uint8_t *drdy)
Read sensor&#39;s data.
tmp006_params_t p
Configuration parameters.
Definition: tmp006.h:145
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:108
int tmp006_read_temperature(const tmp006_t *dev, int16_t *ta, int16_t *to)
Convenience function to get ambient and object temperatures in [°C].
void tmp006_convert(int16_t rawv, int16_t rawt, float *tamb, float *tobj)
Convert raw sensor values to temperature.
uint8_t rate
number of averaged samples
Definition: tmp006.h:138
int tmp006_reset(const tmp006_t *dev)
Reset the TMP006 sensor, afterwards it should be reinitialized.
general error
Definition: tmp006.h:156
int tmp006_set_active(const tmp006_t *dev)
Set active mode, this enables periodic measurements.
I2C bus error.
Definition: tmp006.h:153
Device descriptor for TMP006 sensors.
Definition: tmp006.h:144
int tmp006_init(tmp006_t *dev, const tmp006_params_t *params)
Initialize the TMP006 sensor driver.
Success, no error.
Definition: tmp006.h:152
invalid device configuration
Definition: tmp006.h:155
Low-level I2C peripheral driver interface definition.