Loading...
Searching...
No Matches
dht.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 Ludwig Knüpfer,
3 * 2015 Christian Mehlis
4 * 2016-2017 Freie Universität Berlin
5 *
6 * This file is subject to the terms and conditions of the GNU Lesser
7 * General Public License v2.1. See the file LICENSE in the top level
8 * directory for more details.
9 */
10
11#pragma once
12
32
33#include <errno.h>
34#include <stdint.h>
35
36#include "periph/gpio.h"
37
38#ifdef __cplusplus
39extern "C" {
40#endif
41
45typedef struct {
46 uint16_t humidity;
47 uint16_t temperature;
49
61
71
79
95int dht_init(dht_t *dev, const dht_params_t *params);
96
119int dht_read(dht_t *dev, int16_t *temp, int16_t *hum);
120
121#ifdef __cplusplus
122}
123#endif
124
Low-level GPIO peripheral driver interface definitions.
gpio_mode_t
Available pin modes.
Definition periph_cpu.h:91
dht_type_t
Device type of the DHT device.
Definition dht.h:53
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:56
@ DHT21
DHT21 device identifier.
Definition dht.h:58
@ DHT22
DHT22 device identifier.
Definition dht.h:57
@ DHT11
Older DHT11 variants with either 1 °C or 0.1 °C resolution.
Definition dht.h:54
@ AM2301
AM2301 device identifier.
Definition dht.h:59
Data type for storing DHT sensor readings.
Definition dht.h:45
uint16_t humidity
relative humidity in deci-percent
Definition dht.h:46
uint16_t temperature
temperature in deci-Celsius
Definition dht.h:47
Configuration parameters for DHT devices.
Definition dht.h:65
gpio_mode_t in_mode
input pin configuration, with or without pull resistor
Definition dht.h:68
gpio_t pin
GPIO pin of the device's data pin.
Definition dht.h:66
dht_type_t type
type of the DHT device
Definition dht.h:67
Device descriptor for DHT sensor devices.
Definition dht.h:75
dht_params_t params
Device parameters.
Definition dht.h:76
dht_data_t last_val
Values of the last measurement.
Definition dht.h:77