projects
/
bertos.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add foldback for at91 i2c for nightly test.
[bertos.git]
/
bertos
/
drv
/
pcf8574.c
diff --git
a/bertos/drv/pcf8574.c
b/bertos/drv/pcf8574.c
index a9ed659e29191ecf32327a06f27e8bf7d634de54..5572e40ce3ce29803315fa3bfc3b45d541d7f8ed 100644
(file)
--- a/
bertos/drv/pcf8574.c
+++ b/
bertos/drv/pcf8574.c
@@
-40,11
+40,11
@@
* each pin as input or output, see datasheet on how this
* is achieved.
*
* 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>
*/
#include "pcf8574.h"
* \author Francesco Sacchi <batt@develer.com>
*/
#include "pcf8574.h"
+#include <cfg/module.h>
#include <drv/i2c.h>
/**
#include <drv/i2c.h>
/**
@@
-56,8
+56,13
@@
int pcf8574_get(Pcf8574 *pcf)
if (!i2c_start_r(PCF8574ID | ((pcf->addr << 1) & 0xF7)))
return EOF;
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();
i2c_stop();
+
return data;
}
return data;
}
@@
-67,7
+72,9
@@
int pcf8574_get(Pcf8574 *pcf)
*/
bool pcf8574_put(Pcf8574 *pcf, uint8_t data)
{
*/
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;
}
/**
}
/**