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 
38 #ifndef HDC1000_H
39 #define HDC1000_H
40 
41 #include <stdint.h>
42 
43 #include "periph/i2c.h"
44 #include "hdc1000_regs.h"
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
54 #ifndef HDC1000_I2C_ADDRESS
55 #define HDC1000_I2C_ADDRESS (0x43)
56 #endif
57 
65 #ifndef HDC1000_CONVERSION_TIME
66 #define HDC1000_CONVERSION_TIME (26000)
67 #endif
68 
72 enum {
73  HDC1000_OK = 0,
77 };
78 
82 typedef enum {
83  HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11),
84  HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14)
86 
90 typedef struct {
92  uint8_t addr;
95 
99 typedef struct {
101 } hdc1000_t;
102 
113 int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params);
114 
128 
139 int hdc1000_get_results(hdc1000_t *dev, int16_t *temp, int16_t *hum);
140 
154 int hdc1000_read(hdc1000_t *dev, int16_t *temp, int16_t *hum);
155 
156 #ifdef __cplusplus
157 }
158 #endif
159 
160 #endif /* HDC1000_H */
161 
errors while initializing the I2C bus
Definition: hdc1000.h:75
uint8_t addr
address on that bus
Definition: hdc1000.h:92
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:104
int hdc1000_read(hdc1000_t *dev, int16_t *temp, int16_t *hum)
Convenience function for reading temperature and humidity.
hdc1000_res_t res
resolution used for sampling temp and hum
Definition: hdc1000.h:93
no HDC1000 device found on the bus
Definition: hdc1000.h:74
Register definitions for HDC1000 devices.
11-bit conversion
Definition: hdc1000.h:83
hdc1000_params_t p
Configuration parameters.
Definition: hdc1000.h:100
error during I2C communication
Definition: hdc1000.h:76
i2c_t i2c
bus the device is connected to
Definition: hdc1000.h:91
everything went as expected
Definition: hdc1000.h:73
Parameters needed for device initialization.
Definition: hdc1000.h:90
Device descriptor for HDC1000 sensors.
Definition: hdc1000.h:99
hdc1000_res_t
Possible resolution values.
Definition: hdc1000.h:82
14-bit conversion
Definition: hdc1000.h:84
int hdc1000_get_results(hdc1000_t *dev, int16_t *temp, int16_t *hum)
Read conversion results for temperature and humidity.
int hdc1000_trigger_conversion(hdc1000_t *dev)
Trigger a new conversion.
Low-level I2C peripheral driver interface definition.