mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
a582da1f31
- many backports from @maribu's IRQ based implementation (#18591) - use of ztimer and errno.h - separation of dht_read() steps into functions for better readability - reintroduction of DHT11/DHT22 differentiation - sensor presence checking in dht_init() - default input mode changed to open drain - AVR support without platform-specific handling by avoiding ztimer_spin() and using the overflow of an 8-bit variable as a pre-timeout to minimize time-consuming ztimer_now() calls - add a new DHT11_2022 type for 0.01 °C resolution devices - data caching removed
75 lines
1.5 KiB
C
75 lines
1.5 KiB
C
/*
|
|
* Copyright (C) 2016 Freie Universität Berlin
|
|
*
|
|
* This file is subject to the terms and conditions of the GNU Lesser
|
|
* General Public License v2.1. See the file LICENSE in the top level
|
|
* directory for more details.
|
|
*/
|
|
|
|
/**
|
|
* @ingroup drivers_dht
|
|
*
|
|
* @{
|
|
* @file
|
|
* @brief Default configuration for DHT devices
|
|
*
|
|
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
|
*/
|
|
|
|
#ifndef DHT_PARAMS_H
|
|
#define DHT_PARAMS_H
|
|
|
|
#include "board.h"
|
|
#include "dht.h"
|
|
#include "saul_reg.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/**
|
|
* @name Set default configuration parameters for the DHT devices
|
|
* @{
|
|
*/
|
|
#ifndef DHT_PARAM_PIN
|
|
#define DHT_PARAM_PIN (GPIO_PIN(0, 0))
|
|
#endif
|
|
#ifndef DHT_PARAM_TYPE
|
|
#define DHT_PARAM_TYPE (DHT11)
|
|
#endif
|
|
#ifndef DHT_PARAM_PULL
|
|
#define DHT_PARAM_PULL (GPIO_IN)
|
|
#endif
|
|
#ifndef DHT_PARAMS
|
|
#define DHT_PARAMS { .pin = DHT_PARAM_PIN, \
|
|
.type = DHT_PARAM_TYPE, \
|
|
.in_mode = DHT_PARAM_PULL }
|
|
#endif
|
|
#ifndef DHT_SAULINFO
|
|
#define DHT_SAULINFO { .name = "dht" }
|
|
#endif
|
|
/**@}*/
|
|
|
|
/**
|
|
* @brief Configure DHT devices
|
|
*/
|
|
static const dht_params_t dht_params[] =
|
|
{
|
|
DHT_PARAMS
|
|
};
|
|
|
|
/**
|
|
* @brief Allocate and configure entries to the SAUL registry
|
|
*/
|
|
static const saul_reg_info_t dht_saul_info[] =
|
|
{
|
|
DHT_SAULINFO
|
|
};
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* DHT_PARAMS_H */
|
|
/** @} */
|