mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-01-17 05:32:45 +01:00
drivers/lsm303dlhc: improve debug message during init
This commit is contained in:
parent
64f6b7ffa4
commit
55ef882860
@ -42,15 +42,15 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, const lsm303dlhc_params_t *params)
|
||||
int res;
|
||||
uint8_t tmp;
|
||||
|
||||
DEBUG("lsm303dlhc init...");
|
||||
/* Acquire exclusive access to the bus. */
|
||||
i2c_acquire(DEV_I2C);
|
||||
|
||||
DEBUG("lsm303dlhc reboot...");
|
||||
/* reboot sensor */
|
||||
res = i2c_write_reg(DEV_I2C, DEV_ACC_ADDR,
|
||||
LSM303DLHC_REG_CTRL5_A, LSM303DLHC_REG_CTRL5_A_BOOT, 0);
|
||||
/* Release the bus for other threads. */
|
||||
i2c_release(DEV_I2C);
|
||||
DEBUG("[OK]\n");
|
||||
|
||||
/* configure accelerometer */
|
||||
/* enable all three axis and set sample rate */
|
||||
@ -85,6 +85,12 @@ int lsm303dlhc_init(lsm303dlhc_t *dev, const lsm303dlhc_params_t *params)
|
||||
i2c_release(DEV_I2C);
|
||||
/* configure mag data ready pin */
|
||||
gpio_init(DEV_MAG_PIN, GPIO_IN);
|
||||
if (ENABLE_DEBUG && res == 0) {
|
||||
DEBUG("[OK]\n");
|
||||
}
|
||||
else {
|
||||
DEBUG("[Failed]\n");
|
||||
}
|
||||
|
||||
return (res < 0) ? -1 : 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user