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 
65 #ifndef CONFIG_HDC1000_I2C_ADDRESS
66 #define CONFIG_HDC1000_I2C_ADDRESS (0x43)
67 #endif
68 
76 #ifndef CONFIG_HDC1000_CONVERSION_TIME
77 #define CONFIG_HDC1000_CONVERSION_TIME (26000)
78 #endif
79 
84 enum {
85  HDC1000_OK = 0,
89 };
90 
94 typedef enum {
95  HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11),
96  HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14)
98 
102 typedef struct {
104  uint8_t addr;
106  uint32_t renew_interval;
108 
112 typedef struct {
114 } hdc1000_t;
115 
126 int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params);
127 
140 int hdc1000_trigger_conversion(const hdc1000_t *dev);
141 
152 int hdc1000_get_results(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
153 
167 int hdc1000_read(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
168 
184 int hdc1000_read_cached(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
185 
186 #ifdef __cplusplus
187 }
188 #endif
189 
190 #endif /* HDC1000_H */
191 
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:106
no HDC1000 device found on the bus
Definition: hdc1000.h:86
everything went as expected
Definition: hdc1000.h:85
uint8_t addr
address on that bus
Definition: hdc1000.h:104
error during I2C communication
Definition: hdc1000.h:88
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:151
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:105
Register definitions for HDC1000 devices.
11-bit conversion
Definition: hdc1000.h:95
hdc1000_params_t p
Configuration parameters.
Definition: hdc1000.h:113
i2c_t i2c
bus the device is connected to
Definition: hdc1000.h:103
Parameters needed for device initialization.
Definition: hdc1000.h:102
Device descriptor for HDC1000 sensors.
Definition: hdc1000.h:112
hdc1000_res_t
Possible resolution values.
Definition: hdc1000.h:94
14-bit conversion
Definition: hdc1000.h:96
errors while initializing the I2C bus
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.