drivers/dht: use new driver params scheme

This commit is contained in:
Alexandre Abadie 2018-02-28 16:33:42 +01:00
parent 47a66098e8
commit fffd6a2e07

View File

@ -40,10 +40,14 @@ extern "C" {
#ifndef DHT_PARAM_PULL
#define DHT_PARAM_PULL (GPIO_IN_PU)
#endif
#define DHT_PARAMS_DEFAULT {.pin = DHT_PARAM_PIN, \
#ifndef DHT_PARAMS
#define DHT_PARAMS { .pin = DHT_PARAM_PIN, \
.type = DHT_PARAM_TYPE, \
.in_mode = DHT_PARAM_PULL}
.in_mode = DHT_PARAM_PULL }
#endif
#ifndef DHT_SAULINFO
#define DHT_SAULINFO { .name = "dht" }
#endif
/**@}*/
/**
@ -51,27 +55,16 @@ extern "C" {
*/
static const dht_params_t dht_params[] =
{
#ifdef DHT_PARAMS_BOARD
DHT_PARAMS_BOARD,
#else
DHT_PARAMS_DEFAULT,
#endif
DHT_PARAMS
};
/**
* @brief Get the number of configured DHT devices
*/
#define DHT_NUMOF (sizeof(dht_params) / sizeof(dht_params[0]))
#ifdef MODULE_SAUL_REG
/**
* @brief Allocate and configure entries to the SAUL registry
*/
static const saul_reg_info_t dht_saul_reg_info[] =
static const saul_reg_info_t dht_saul_info[] =
{
{ .name = "dht" }
DHT_SAULINFO
};
#endif
#ifdef __cplusplus
}