Loading...
Searching...
No Matches
hdc1000.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2014 PHYTEC Messtechnik GmbH
3 * SPDX-FileCopyrightText: 2017 Freie Universität Berlin
4 * SPDX-License-Identifier: LGPL-2.1-only
5 */
6
7#pragma once
8
39
40#include <stdint.h>
41
42#include "periph/i2c.h"
43#include "hdc1000_regs.h"
44
45#ifdef __cplusplus
46extern "C"
47{
48#endif
49
61#ifndef CONFIG_HDC1000_I2C_ADDRESS
62#define CONFIG_HDC1000_I2C_ADDRESS (0x43)
63#endif
64
72#ifndef CONFIG_HDC1000_CONVERSION_TIME
73#define CONFIG_HDC1000_CONVERSION_TIME (26000)
74#endif
76
80enum {
85};
86
90typedef enum {
91 HDC1000_11BIT = (HDC1000_TRES11 | HDC1000_HRES11),
92 HDC1000_14BIT = (HDC1000_TRES14 | HDC1000_HRES14)
94
98typedef struct {
100 uint8_t addr;
102 uint32_t renew_interval;
104
108typedef struct {
110} hdc1000_t;
111
122int hdc1000_init(hdc1000_t *dev, const hdc1000_params_t *params);
123
137
148int hdc1000_get_results(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
149
163int hdc1000_read(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
164
180int hdc1000_read_cached(const hdc1000_t *dev, int16_t *temp, int16_t *hum);
181
182#ifdef __cplusplus
183}
184#endif
185
int hdc1000_trigger_conversion(const hdc1000_t *dev)
Trigger a new conversion.
int hdc1000_get_results(const 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.
hdc1000_res_t
Possible resolution values.
Definition hdc1000.h:90
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.
@ HDC1000_14BIT
14-bit conversion
Definition hdc1000.h:92
@ HDC1000_11BIT
11-bit conversion
Definition hdc1000.h:91
@ HDC1000_NOBUS
errors while initializing the I2C bus
Definition hdc1000.h:83
@ HDC1000_BUSERR
error during I2C communication
Definition hdc1000.h:84
@ HDC1000_NODEV
no HDC1000 device found on the bus
Definition hdc1000.h:82
@ HDC1000_OK
everything went as expected
Definition hdc1000.h:81
uint_fast8_t i2c_t
Default i2c_t type definition.
Definition i2c.h:155
Register definitions for HDC1000 devices.
Low-level I2C peripheral driver interface definition.
Parameters needed for device initialization.
Definition hdc1000.h:98
uint32_t renew_interval
interval for cache renewal
Definition hdc1000.h:102
hdc1000_res_t res
resolution used for sampling temp and hum
Definition hdc1000.h:101
uint8_t addr
address on that bus
Definition hdc1000.h:100
i2c_t i2c
bus the device is connected to
Definition hdc1000.h:99
Device descriptor for HDC1000 sensors.
Definition hdc1000.h:108
hdc1000_params_t p
Configuration parameters.
Definition hdc1000.h:109