romilly/quick2wire-python-api

Example in comments in i2c.py doesn't works (for me)

gustavovelascoh opened this issue · 0 comments

This example provided in comments of i2c.py does not works for me, appears a TypeError message:

"For example:

    from quick2wire.i2c import I2CMaster, writing

    with I2CMaster() as i2c:
        i2c.transaction(
            writing(0x20, bytes([0x01, 0xFF])))"

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
TypeError: 'tuple' object is not callable

I have to change it to this for it to work:

For example:

    from quick2wire.i2c import I2CMaster, writing

    with I2CMaster() as i2c:
        i2c.transaction(
            writing(0x20, (0x01, 0xFF)))