sys/auto_init: update l3g4200d with new API
This commit is contained in:
parent
2ace1a2dfe
commit
53ffe88384
@ -41,6 +41,11 @@ static l3g4200d_t l3g4200d_devs[L3G4200D_NUM];
|
|||||||
*/
|
*/
|
||||||
static saul_reg_t saul_entries[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
|
* @brief Reference the driver struct
|
||||||
*/
|
*/
|
||||||
@ -49,14 +54,12 @@ extern saul_driver_t l3g4200d_saul_driver;
|
|||||||
|
|
||||||
void auto_init_l3g4200d(void)
|
void auto_init_l3g4200d(void)
|
||||||
{
|
{
|
||||||
for (unsigned int i = 0; i < L3G4200D_NUM; i++) {
|
assert(L3G4200D_NUM == L3G4200D_INFO_NUM);
|
||||||
const l3g4200d_params_t *p = &l3g4200d_params[i];
|
|
||||||
|
|
||||||
|
for (unsigned int i = 0; i < L3G4200D_NUM; i++) {
|
||||||
LOG_DEBUG("[auto_init_saul] initializing l3g4200d #%u\n", i);
|
LOG_DEBUG("[auto_init_saul] initializing l3g4200d #%u\n", i);
|
||||||
|
|
||||||
int res = l3g4200d_init(&l3g4200d_devs[i], p->i2c, p->addr,
|
if (l3g4200d_init(&l3g4200d_devs[i], &l3g4200d_params[i]) < 0) {
|
||||||
p->int1_pin, p->int2_pin, p->mode, p->scale);
|
|
||||||
if (res < 0) {
|
|
||||||
LOG_ERROR("[auto_init_saul] error initializing l3g4200d #%u\n", i);
|
LOG_ERROR("[auto_init_saul] error initializing l3g4200d #%u\n", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user