Merged revisions 4004-4036,4039-4048,4050-4095,4097-4100 via svnmerge from
[bertos.git] / bertos / cpu / avr / drv / i2c_avr.c
index 739e4ab371c3205722956b154f6972a00aaa8a3f..ebbe5a2938ff50fe04a5f8f6ec869fe3ff974a54 100644 (file)
@@ -34,6 +34,7 @@
  *
  * \author Stefano Fedrigo <aleph@develer.com>
  * \author Bernie Innocenti <bernie@codewiz.org>
+ * \author Daniele Basile <asterix@develer.com>
  */
 
 #include <hw/hw_cpufreq.h>  /* CPU_FREQ */
@@ -378,7 +379,7 @@ static uint8_t i2c_avr_getc(I2c *i2c)
 
        WAIT_READY();
 
-       if (TW_STATUS != TW_MR_DATA_ACK)
+       if (TW_STATUS != data_flag)
        {
                LOG_ERR("Data nack[%x]\n", TWSR);
                i2c->errors |= I2C_DATA_NACK;
@@ -451,6 +452,4 @@ void i2c_hw_init(I2c *i2c, int dev, uint32_t clock)
                TWSR = 0;
                TWCR = BV(TWEN);
        );
-
-       MOD_INIT(i2c);
 }