hdc1000.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 PHYTEC Messtechnik GmbH
3  * 2017 Freie Universit├Ąt Berlin
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 
41 #ifndef HDC1000_H
42 #define HDC1000_H
43 
44 #include <stdint.h>
45 
46 #include "periph/i2c.h"
47 #include "hdc1000_regs.h"
48 
49 #ifdef __cplusplus
50 extern "C"
51 {
52 #endif
53 
57 #ifndef HDC1000_I2C_ADDRESS
58 #define HDC1000_I2C_ADDRESS (0x43)
59 #endif
60 
68 #ifndef HDC1000_CONVERSION_TIME
69 #define HDC1000_CONVERSION_TIME (26000)
70 #endif
71 
75 enum {
76  HDC1000_OK = 0,
80 };
81 
85 typedef enum {
86  HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11),
87  HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14)
89 
93 typedef struct {
95  uint8_t addr;
97  uint32_t renew_interval;
99 
103 typedef struct {
105 } hdc1000_t;
106 
117 int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params);
118 
131 int hdc1000_trigger_conversion(const hdc1000_t *dev);
132 
143 int hdc1000_get_results(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
144 
158 int hdc1000_read(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
159 
174 int hdc1000_read_cached(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif /* HDC1000_H */
181 
int hdc1000_read_cached(const hdc1000_t *dev, int16_t *temp, int16_t *hum)
Extended read function including caching capability.
int hdc1000_read(const hdc1000_t *dev, int16_t *temp, int16_t *hum)
Convenience function for reading temperature and humidity.
uint32_t renew_interval
interval for cache renewal
Definition: hdc1000.h:97
uint8_t addr
address on that bus
Definition: hdc1000.h:95
int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params)
Initialize the given HDC1000 device.
unsigned int i2c_t
Default i2c_t type definition.
Definition: i2c.h:157
no HDC1000 device found on the bus
Definition: hdc1000.h:77
errors while initializing the I2C bus
Definition: hdc1000.h:78
everything went as expected
Definition: hdc1000.h:76
error during I2C communication
Definition: hdc1000.h:79
int hdc1000_trigger_conversion(const hdc1000_t *dev)
Trigger a new conversion.
hdc1000_res_t res
resolution used for sampling temp and hum
Definition: hdc1000.h:96
Register definitions for HDC1000 devices.
11-bit conversion
Definition: hdc1000.h:86
hdc1000_params_t p
Configuration parameters.
Definition: hdc1000.h:104
i2c_t i2c
bus the device is connected to
Definition: hdc1000.h:94
Parameters needed for device initialization.
Definition: hdc1000.h:93
Device descriptor for HDC1000 sensors.
Definition: hdc1000.h:103
hdc1000_res_t
Possible resolution values.
Definition: hdc1000.h:85
14-bit conversion
Definition: hdc1000.h:87
int hdc1000_get_results(const hdc1000_t *dev, int16_t *temp, int16_t *hum)
Read conversion results for temperature and humidity.
Low-level I2C peripheral driver interface definition.