From 0901947e8d8500bb8120febd32587bc1eeabca98 Mon Sep 17 00:00:00 2001 From: ticso Date: Mon, 27 Sep 2010 15:58:19 +0000 Subject: The TWI controller automatically stops if we don't fill up with new data in time. --- sys/arm/at91/at91_twi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/arm/at91/at91_twi.c b/sys/arm/at91/at91_twi.c index 6442d07..b101772 100644 --- a/sys/arm/at91/at91_twi.c +++ b/sys/arm/at91/at91_twi.c @@ -338,7 +338,7 @@ at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) err = EINVAL; goto out; } - if (len == 1) + if (len == 1 && msgs[i].flags & IIC_M_RD) WR4(sc, TWI_CR, TWI_CR_START | TWI_CR_STOP); else WR4(sc, TWI_CR, TWI_CR_START); @@ -358,8 +358,6 @@ at91_twi_transfer(device_t dev, struct iic_msg *msgs, uint32_t nmsgs) } } else { while (len--) { - if (len == 0 && msgs[i].len != 1) - WR4(sc, TWI_CR, TWI_CR_STOP); if ((err = at91_twi_wait(sc, TWI_SR_TXRDY))) goto out; WR4(sc, TWI_THR, *buf++); -- cgit v1.1