Open jabdoa2 opened 6 years ago
Thanks for your contribution ! I cannot test it right now (no i2c device at hand), do you need it integrated quickly (with a pip release) or can it wait a bit ?
It can wait a bit. The feature is not upstream yet in MPF so our users are not using it yet. I tested it with a RPi3 and a MMA8451.
I'm wanting to use an i2c LCD display (using the pigpio I2C LCD class) asynchronously. I think that everything is covered in this PR, except the _i2c_writedevice method. I'm still getting to grips with async in Python so have broadly adapted the pigpio module's code, following your refactoring process to get the following code:
@asyncio.coroutine
def i2c_write_device(self, handle, data):
"""Writes the data bytes to the raw device associated with handle."""
if len(data):
res = yield from self._pigpio_aio_command_ext(_PI_CMD_I2CWD, handle, 0, len(data), [data])
return _u2i(res)
else:
return 0
If this is correct, please can you add it to this PR? Thanks!
@orbsmiv: just create a PR based on my PR. Please also test it.
@jabdoa2 sure, although I've not done a stacked PR before... is the process to fork your repo and then submit a PR on your _add_i2ccommands branch?
Fork mine and then create a PR against this repo. That will also contain the changes of my PR which then would have to be merged first
@PierreRust any chance we can merge this?
Add some i2c commands:
Fix locking and asyncio sendall calls