From 2c07ad926046d212754b01c5811a59ef9ae7cf7d Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Fri, 11 Apr 2014 17:06:24 +0100 Subject: [PATCH] readi2c: modify examples to use I2CSlave api --- examples/python/readi2c.py | 5 +++-- examples/readi2c.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/python/readi2c.py b/examples/python/readi2c.py index afd200a..e4234fb 100644 --- a/examples/python/readi2c.py +++ b/examples/python/readi2c.py @@ -2,8 +2,9 @@ import pymaa -x = pymaa.I2C(27,28) +x = pymaa.I2CSlave(27,28) +x.address(0x62) y= " " -ret = x.read(0x62, y, 2) +ret = x.read(y, 2) print(y) diff --git a/examples/readi2c.cpp b/examples/readi2c.cpp index c7ec6a5..5ab7b01 100644 --- a/examples/readi2c.cpp +++ b/examples/readi2c.cpp @@ -3,9 +3,12 @@ int main () { - maa::I2C i2c(28, 27); + maa::I2CSlave i2c(26, 27); + int addr = 0x62; + i2c.address(addr); + char data[2]; - int ret = i2c.read(addr, data, 2); + int ret = i2c.read(data, 2); return ret; } -- 2.7.4