The friendly Operating System for the Internet of Things
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,
76 };
77 
81 typedef enum {
82  HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11),
83  HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14)
85 
89 typedef struct {
91  uint8_t addr;
94 
98 typedef struct {
100 } hdc1000_t;
101 
112 int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params);
113 
124 
132 void hdc1000_get_results(hdc1000_t *dev, int16_t *temp, int16_t *hum);
133 
144 void hdc1000_read(hdc1000_t *dev, int16_t *temp, int16_t *hum);
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif
151 
void hdc1000_trigger_conversion(hdc1000_t *dev)
Trigger a new conversion.
uint8_t addr
address on that bus
Definition: hdc1000.h:91
void hdc1000_get_results(hdc1000_t *dev, int16_t *temp, int16_t *hum)
Read conversion results for temperature and humidity.
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
hdc1000_res_t res
resolution used for sampling temp and hum
Definition: hdc1000.h:92
errors while initializing the I2C bus
Definition: hdc1000.h:75
Register definitions for HDC1000 devices.
11-bit conversion
Definition: hdc1000.h:82
hdc1000_params_t p
Configuration parameters.
Definition: hdc1000.h:99
i2c_t i2c
bus the device is connected to
Definition: hdc1000.h:90
Parameters needed for device initialization.
Definition: hdc1000.h:89
Device descriptor for HDC1000 sensors.
Definition: hdc1000.h:98
hdc1000_res_t
Possible resolution values.
Definition: hdc1000.h:81
14-bit conversion
Definition: hdc1000.h:83
no HDC1000 device found on the bus
Definition: hdc1000.h:74
void hdc1000_read(hdc1000_t *dev, int16_t *temp, int16_t *hum)
Convenience function for reading temperature and humidity.
everything went as expected
Definition: hdc1000.h:73
Low-level I2C peripheral driver interface definition.