diff --git a/sys/auto_init/saul/auto_init_l3g4200d.c b/sys/auto_init/saul/auto_init_l3g4200d.c index d23fce6579..36d3182314 100644 --- a/sys/auto_init/saul/auto_init_l3g4200d.c +++ b/sys/auto_init/saul/auto_init_l3g4200d.c @@ -29,7 +29,7 @@ /** * @brief Define the number of configured sensors */ -#define L3G4200D_NUM (sizeof(l3g4200d_params)/sizeof(l3g4200d_params[0])) +#define L3G4200D_NUM (sizeof(l3g4200d_params) / sizeof(l3g4200d_params[0])) /** * @brief Allocate memory for the device descriptors @@ -41,6 +41,11 @@ static l3g4200d_t l3g4200d_devs[L3G4200D_NUM]; */ static saul_reg_t saul_entries[L3G4200D_NUM]; +/** + * @brief Define the number of saul info + */ +#define L3G4200D_INFO_NUM (sizeof(l3g4200d_saul_info) / sizeof(l3g4200d_saul_info[0])) + /** * @brief Reference the driver struct */ @@ -49,14 +54,12 @@ extern saul_driver_t l3g4200d_saul_driver; void auto_init_l3g4200d(void) { - for (unsigned int i = 0; i < L3G4200D_NUM; i++) { - const l3g4200d_params_t *p = &l3g4200d_params[i]; + assert(L3G4200D_NUM == L3G4200D_INFO_NUM); + for (unsigned int i = 0; i < L3G4200D_NUM; i++) { LOG_DEBUG("[auto_init_saul] initializing l3g4200d #%u\n", i); - int res = l3g4200d_init(&l3g4200d_devs[i], p->i2c, p->addr, - p->int1_pin, p->int2_pin, p->mode, p->scale); - if (res < 0) { + if (l3g4200d_init(&l3g4200d_devs[i], &l3g4200d_params[i]) < 0) { LOG_ERROR("[auto_init_saul] error initializing l3g4200d #%u\n", i); continue; }