diff --git a/drivers/dht/include/dht_params.h b/drivers/dht/include/dht_params.h index 333678face..3bdd3dc981 100644 --- a/drivers/dht/include/dht_params.h +++ b/drivers/dht/include/dht_params.h @@ -67,12 +67,9 @@ static const dht_params_t dht_params[] = /** * @brief Allocate and configure entries to the SAUL registry */ -static const saul_reg_info_t dht_saul_info[][2] = +static const saul_reg_info_t dht_saul_reg_info[] = { - { - { .name = "dht-temp" }, - { .name = "dht-hum" } - } + { .name = "dht" } }; #endif diff --git a/drivers/include/dht.h b/drivers/include/dht.h index 783136fc29..e937750479 100644 --- a/drivers/include/dht.h +++ b/drivers/include/dht.h @@ -30,7 +30,6 @@ #include -#include "saul.h" #include "periph/gpio.h" #ifdef __cplusplus @@ -78,14 +77,6 @@ typedef struct { */ typedef dht_t dht_params_t; -/** - * @brief export SAUL endpoints - * @{ - */ -extern const saul_driver_t dht_temp_saul_driver; -extern const saul_driver_t dht_hum_saul_driver; -/** @} */ - /** * @brief auto-initialize all configured DHT devices */ diff --git a/sys/auto_init/saul/auto_init_dht.c b/sys/auto_init/saul/auto_init_dht.c index 2d711095d3..3d687d6d90 100644 --- a/sys/auto_init/saul/auto_init_dht.c +++ b/sys/auto_init/saul/auto_init_dht.c @@ -23,27 +23,35 @@ #include "log.h" #include "saul_reg.h" -#include "dht.h" #include "dht_params.h" +#include "dht.h" /** * @brief Define the number of configured sensors */ -#define DHT_NUM (sizeof(dht_params) / sizeof(dht_params[0])) +#define DHT_NUMOF (sizeof(dht_params) / sizeof(dht_params[0])) /** * @brief Allocate memory for the device descriptors */ -static dht_t dht_devs[DHT_NUM]; +static dht_t dht_devs[DHT_NUMOF]; + +/** + * @brief Import SAUL endpoints + * @{ + */ +extern const saul_driver_t dht_temp_saul_driver; +extern const saul_driver_t dht_hum_saul_driver; +/** @} */ /** * @brief Memory for the SAUL registry entries */ -static saul_reg_t saul_entries[DHT_NUM * 2]; +static saul_reg_t saul_entries[DHT_NUMOF * 2]; void auto_init_dht(void) { - for (unsigned int i = 0; i < DHT_NUM; i++) { + for (unsigned int i = 0; i < DHT_NUMOF; i++) { LOG_DEBUG("[auto_init_saul] initializing dht #%u\n", i); if (dht_init(&dht_devs[i], &dht_params[i]) != DHT_OK) { @@ -52,10 +60,10 @@ void auto_init_dht(void) } saul_entries[(i * 2)].dev = &(dht_devs[i]); - saul_entries[(i * 2)].name = dht_saul_info[i][0].name; + saul_entries[(i * 2)].name = dht_saul_reg_info[i].name; saul_entries[(i * 2)].driver = &dht_temp_saul_driver; saul_entries[(i * 2) + 1].dev = &(dht_devs[i]); - saul_entries[(i * 2) + 1].name = dht_saul_info[i][1].name; + saul_entries[(i * 2) + 1].name = dht_saul_reg_info[i].name; saul_entries[(i * 2) + 1].driver = &dht_hum_saul_driver; saul_reg_add(&(saul_entries[(i * 2)])); saul_reg_add(&(saul_entries[(i * 2) + 1]));