Skip to content
Snippets Groups Projects
Commit 902d8946 authored by Alexandre Abadie's avatar Alexandre Abadie
Browse files

sys/auto_init: cleanup si70xx auto_init

parent 19cf25c7
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ extern "C" { ...@@ -42,7 +42,7 @@ extern "C" {
#endif #endif
#ifndef SI70XX_PARAMS #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 } .address = SI70XX_PARAM_ADDR }
#endif #endif
#ifndef SI70XX_SAUL_INFO #ifndef SI70XX_SAUL_INFO
...@@ -61,7 +61,7 @@ static const si70xx_params_t si70xx_params[] = ...@@ -61,7 +61,7 @@ static const si70xx_params_t si70xx_params[] =
/** /**
* @brief Configure SAUL registry entries * @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 SI70XX_SAUL_INFO
}; };
......
...@@ -28,25 +28,25 @@ ...@@ -28,25 +28,25 @@
/** /**
* @brief Define the number of configured sensors * @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 * @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 * @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 * @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; extern const saul_driver_t si70xx_temperature_saul_driver;
...@@ -55,9 +55,9 @@ extern const saul_driver_t si70xx_relative_humidity_saul_driver; ...@@ -55,9 +55,9 @@ extern const saul_driver_t si70xx_relative_humidity_saul_driver;
void auto_init_si70xx(void) 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); LOG_DEBUG("[auto_init_saul] initializing SI70xx #%u\n", i);
if (si70xx_init(&si70xx_devs[i], &si70xx_params[i]) != SI70XX_OK) { if (si70xx_init(&si70xx_devs[i], &si70xx_params[i]) != SI70XX_OK) {
...@@ -67,12 +67,12 @@ void auto_init_si70xx(void) ...@@ -67,12 +67,12 @@ void auto_init_si70xx(void)
/* temperature */ /* temperature */
saul_entries[i * 2].dev = &si70xx_devs[i]; 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; saul_entries[i * 2].driver = &si70xx_temperature_saul_driver;
/* relative humidity */ /* relative humidity */
saul_entries[(i * 2) + 1].dev = &si70xx_devs[i]; 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 = \ saul_entries[(i * 2) + 1].driver = \
&si70xx_relative_humidity_saul_driver; &si70xx_relative_humidity_saul_driver;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment