Private
Public Access
2
0

i2cslave: first possibly working implementation of i2cslave api

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll
2014-04-11 15:46:27 +01:00
parent 84beaf2c05
commit 7eb9fa64a9
5 changed files with 13 additions and 2 deletions

View File

@@ -47,7 +47,10 @@ I2CSlave::frequency(int hz)
int
I2CSlave::read(char *data, int length)
{
return 0;
if (this->read(data, length) == length) {
return length;
}
return -1;
}
int
@@ -81,8 +84,12 @@ I2CSlave::write(int data)
}
void
I2CSlave::address(int address)
I2CSlave::address(int addr)
{
_addr = addr;
if (ioctl(i2c_handle, I2C_SLAVE_FORCE, addr) < 0) {
fprintf(stderr, "Failed to set slave address %d\n", addr);
}
}
void