Loading...
Searching...
No Matches
dht.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2015 Ludwig Knüpfer
3 * SPDX-FileCopyrightText: 2015 Christian Mehlis
4 * SPDX-FileCopyrightText: 2016-2017 Freie Universität Berlin
5 * SPDX-License-Identifier: LGPL-2.1-only
6 */
7
8#pragma once
9
29
30#include <errno.h>
31#include <stdint.h>
32
33#include "periph/gpio.h"
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
42typedef struct {
43 uint16_t humidity;
44 uint16_t temperature;
46
58
68
76
92int dht_init(dht_t *dev, const dht_params_t *params);
93
116int dht_read(dht_t *dev, int16_t *temp, int16_t *hum);
117
118#ifdef __cplusplus
119}
120#endif
121
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:96
dht_type_t
Device type of the DHT device.
Definition dht.h:50
int dht_read(dht_t *dev, int16_t *temp, int16_t *hum)
get a new temperature and/or humidity value from the device
int dht_init(dht_t *dev, const dht_params_t *params)
Initialize a new DHT device.
@ DHT11_2022
New DHT11 variant with 0.01 °C resolution.
Definition dht.h:53
@ DHT21
DHT21 device identifier.
Definition dht.h:55
@ DHT22
DHT22 device identifier.
Definition dht.h:54
@ DHT11
Older DHT11 variants with either 1 °C or 0.1 °C resolution.
Definition dht.h:51
@ AM2301
AM2301 device identifier.
Definition dht.h:56
Data type for storing DHT sensor readings.
Definition dht.h:42
uint16_t humidity
relative humidity in deci-percent
Definition dht.h:43
uint16_t temperature
temperature in deci-Celsius
Definition dht.h:44
Configuration parameters for DHT devices.
Definition dht.h:62
gpio_mode_t in_mode
input pin configuration, with or without pull resistor
Definition dht.h:65
gpio_t pin
GPIO pin of the device's data pin.
Definition dht.h:63
dht_type_t type
type of the DHT device
Definition dht.h:64
Device descriptor for DHT sensor devices.
Definition dht.h:72
dht_params_t params
Device parameters.
Definition dht.h:73
dht_data_t last_val
Values of the last measurement.
Definition dht.h:74