Use recv instead get.
[bertos.git] / bertos / drv / pcf8574.c
index 41d54e0ca8b234ac9e113c203355f9ab641b8f69..5572e40ce3ce29803315fa3bfc3b45d541d7f8ed 100644 (file)
@@ -40,7 +40,6 @@
  * each pin as input or output, see datasheet on how this
  * is achieved.
  *
- * \version $Id: ft245rl.c 22301 2008-09-09 16:53:17Z batt $
  * \author Francesco Sacchi <batt@develer.com>
  */
 
@@ -57,8 +56,13 @@ int pcf8574_get(Pcf8574 *pcf)
        if (!i2c_start_r(PCF8574ID | ((pcf->addr << 1) & 0xF7)))
                return EOF;
 
-       int data = i2c_get(false);
+       int data; 
+       
+       if (!i2c_recv(&data, 1))
+               data = EOF;
+               
        i2c_stop();
+       
        return data;
 }
 
@@ -68,7 +72,9 @@ int pcf8574_get(Pcf8574 *pcf)
  */
 bool pcf8574_put(Pcf8574 *pcf, uint8_t data)
 {
-       return  i2c_start_w(PCF8574ID | ((pcf->addr << 1) & 0xF7)) && i2c_put(data) && i2c_stop();
+       bool res = i2c_start_w(PCF8574ID | ((pcf->addr << 1) & 0xF7)) && i2c_put(data);
+       i2c_stop();
+       return res;
 }
 
 /**