Be a little more careful about calling arch_reset in hmc5843, and make

it optional (if gyros are also on i2c, it's better to let the
    gyro/aspirin driver handle reset)
This commit is contained in:
Allen
2011-02-24 16:47:32 -08:00
parent 03ba316f63
commit 2225be9d8a
+4 -2
View File
@@ -46,11 +46,11 @@ void hmc5843_idle_task(void)
{
if (hmc5843.initialized && hmc5843.ready_for_read && (hmc5843.i2c_trans.status == I2CTransSuccess || hmc5843.i2c_trans.status == I2CTransFailed)) {
if (i2c2.status == I2CIdle && i2c_idle(&i2c2)) {
hmc5843.ready_for_read = FALSE;
hmc5843.i2c_trans.type = I2CTransRx;
hmc5843.i2c_trans.len_r = 7;
i2c_submit(&i2c2, &hmc5843.i2c_trans);
hmc5843.reading = TRUE;
hmc5843.ready_for_read = FALSE;
}
}
@@ -70,8 +70,10 @@ void hmc5843_periodic(void)
if (!hmc5843.initialized) {
send_config();
hmc5843.initialized = TRUE;
} else if (hmc5843.timeout++ > HMC5843_TIMEOUT) {
} else if (hmc5843.timeout++ > HMC5843_TIMEOUT && i2c2.status == I2CIdle && i2c_idle(&i2c2)){
#ifdef USE_HMC59843_ARCH_RESET
hmc5843_arch_reset();
#endif
hmc5843.i2c_trans.type = I2CTransRx;
hmc5843.i2c_trans.len_r = 7;
i2c_submit(&i2c2, &hmc5843.i2c_trans);