readi2c: modify examples to use I2CSlave api
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
|
|
||||||
import pymaa
|
import pymaa
|
||||||
|
|
||||||
x = pymaa.I2C(27,28)
|
x = pymaa.I2CSlave(27,28)
|
||||||
|
x.address(0x62)
|
||||||
y= " "
|
y= " "
|
||||||
ret = x.read(0x62, y, 2)
|
ret = x.read(y, 2)
|
||||||
|
|
||||||
print(y)
|
print(y)
|
||||||
|
|||||||
@@ -3,9 +3,12 @@
|
|||||||
int
|
int
|
||||||
main ()
|
main ()
|
||||||
{
|
{
|
||||||
maa::I2C i2c(28, 27);
|
maa::I2CSlave i2c(26, 27);
|
||||||
|
|
||||||
int addr = 0x62;
|
int addr = 0x62;
|
||||||
|
i2c.address(addr);
|
||||||
|
|
||||||
char data[2];
|
char data[2];
|
||||||
int ret = i2c.read(addr, data, 2);
|
int ret = i2c.read(data, 2);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user