Add test stop and generic error.
[bertos.git] / bertos / drv / i2c.h
index 93ba3dfc58739be09e6abf97fac926cff026dd54..1a0dbffedc64067e0af9600e2ccaad0ed939344b 100644 (file)
@@ -134,10 +134,13 @@ bool i2c_recv(void *_buf, size_t count);
  *
  */
 #define I2C_OK               0
-#define I2C_START_ERR     BV(0)
+#define I2C_ERR           BV(3)
+#define I2C_ARB_LOST      BV(2)
+#define I2C_START_TIMEOUT BV(0)
 #define I2C_NO_ACK        BV(1)
 
 
+
 #define I2C_NOSTOP           0
 #define I2C_STOP          BV(0)
 #define I2C_START_R       BV(1)
@@ -145,6 +148,7 @@ bool i2c_recv(void *_buf, size_t count);
 
 
 #define I2C_TEST_START(flag)  ((flag) & I2C_START_R)
+#define I2C_TEST_STOP(flag)   ((flag) & I2C_STOP)
 
 struct I2cHardware;
 struct I2c;
@@ -192,14 +196,14 @@ INLINE void i2c_start_r(I2c *i2c, uint16_t slave_addr, size_t size, int flags)
 {
        ASSERT(i2c);
        i2c->flags = flags | I2C_START_R;
-       i2c_start(i2c, slave_addr)
+       i2c_start(i2c, slave_addr, size);
 }
 
 INLINE void i2c_start_w(I2c *i2c, uint16_t slave_addr, size_t size, int flags)
 {
        ASSERT(i2c);
        i2c->flags = flags & ~I2C_START_R;
-       i2c_start(i2c, slave_addr);
+       i2c_start(i2c, slave_addr, size);
 }
 
 INLINE uint8_t i2c_get(I2c *i2c)