1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

sys/auto_init: cleanup si70xx auto_init

This commit is contained in:
Alexandre Abadie 2018-02-28 17:37:19 +01:00
parent 19cf25c7fb
commit 902d8946a4
2 changed files with 11 additions and 11 deletions

View File

@ -42,7 +42,7 @@ extern "C" {
#endif
#ifndef SI70XX_PARAMS
#define SI70XX_PARAMS { .i2c_dev = SI70XX_PARAM_I2C_DEV, \
#define SI70XX_PARAMS { .i2c_dev = SI70XX_PARAM_I2C_DEV, \
.address = SI70XX_PARAM_ADDR }
#endif
#ifndef SI70XX_SAUL_INFO
@ -61,7 +61,7 @@ static const si70xx_params_t si70xx_params[] =
/**
* @brief Configure SAUL registry entries
*/
static const saul_reg_info_t si70xx_saul_reg_info[] =
static const saul_reg_info_t si70xx_saul_info[] =
{
SI70XX_SAUL_INFO
};

View File

@ -28,25 +28,25 @@
/**
* @brief Define the number of configured sensors
*/
#define SI70XX_NUMOF (sizeof(si70xx_params) / sizeof(si70xx_params[0]))
#define SI70XX_NUM (sizeof(si70xx_params) / sizeof(si70xx_params[0]))
/**
* @brief Allocation of memory for device descriptors
*/
static si70xx_t si70xx_devs[SI70XX_NUMOF];
static si70xx_t si70xx_devs[SI70XX_NUM];
/**
* @brief Memory for the SAUL registry entries
*/
static saul_reg_t saul_entries[SI70XX_NUMOF * 2];
static saul_reg_t saul_entries[SI70XX_NUM * 2];
/**
* @brief Define the number of saul info
*/
#define SI70XX_INFO_NUMOF (sizeof(si70xx_saul_reg_info) / sizeof(si70xx_saul_reg_info[0]))
#define SI70XX_INFO_NUM (sizeof(si70xx_saul_info) / sizeof(si70xx_saul_info[0]))
/**
* @brief Reference the driver structs.
* @name Reference the driver structs.
* @{
*/
extern const saul_driver_t si70xx_temperature_saul_driver;
@ -55,9 +55,9 @@ extern const saul_driver_t si70xx_relative_humidity_saul_driver;
void auto_init_si70xx(void)
{
assert(SI70XX_INFO_NUMOF == SI70XX_NUMOF);
assert(SI70XX_INFO_NUM == SI70XX_NUM);
for (unsigned i = 0; i < SI70XX_NUMOF; i++) {
for (unsigned i = 0; i < SI70XX_NUM; i++) {
LOG_DEBUG("[auto_init_saul] initializing SI70xx #%u\n", i);
if (si70xx_init(&si70xx_devs[i], &si70xx_params[i]) != SI70XX_OK) {
@ -67,12 +67,12 @@ void auto_init_si70xx(void)
/* temperature */
saul_entries[i * 2].dev = &si70xx_devs[i];
saul_entries[i * 2].name = si70xx_saul_reg_info[i].name;
saul_entries[i * 2].name = si70xx_saul_info[i].name;
saul_entries[i * 2].driver = &si70xx_temperature_saul_driver;
/* relative humidity */
saul_entries[(i * 2) + 1].dev = &si70xx_devs[i];
saul_entries[(i * 2) + 1].name = si70xx_saul_reg_info[i].name;
saul_entries[(i * 2) + 1].name = si70xx_saul_info[i].name;
saul_entries[(i * 2) + 1].driver = \
&si70xx_relative_humidity_saul_driver;