mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 22:33:35 +08:00
Hack bus reset support into the old-style hmc5883 driver.
This commit is contained in:
@@ -323,13 +323,20 @@ hmc5883l_ioctl(struct file *filp, int cmd, unsigned long arg)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern int up_i2creset(FAR struct i2c_dev_s * dev);
|
||||||
|
|
||||||
int hmc5883l_reset()
|
int hmc5883l_reset()
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
#if 1
|
||||||
|
ret = up_i2creset(hmc5883l_dev.i2c);
|
||||||
|
printf("HMC5883: BUS RESET %s\n", ret ? "FAIL" : "OK");
|
||||||
|
#else
|
||||||
printf("[hmc5883l drv] Resettet I2C2 BUS\n");
|
printf("[hmc5883l drv] Resettet I2C2 BUS\n");
|
||||||
up_i2cuninitialize(hmc5883l_dev.i2c);
|
up_i2cuninitialize(hmc5883l_dev.i2c);
|
||||||
hmc5883l_dev.i2c = up_i2cinitialize(2);
|
hmc5883l_dev.i2c = up_i2cinitialize(2);
|
||||||
I2C_SETFREQUENCY(hmc5883l_dev.i2c, 400000);
|
I2C_SETFREQUENCY(hmc5883l_dev.i2c, 400000);
|
||||||
|
#endif
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user