Skip to content

add i2c commands#11

Open
jabdoa2 wants to merge 3 commits intoPierreRust:masterfrom
jabdoa2:add_i2c_commands
Open

add i2c commands#11
jabdoa2 wants to merge 3 commits intoPierreRust:masterfrom
jabdoa2:add_i2c_commands

Conversation

@jabdoa2
Copy link
Copy Markdown
Contributor

@jabdoa2 jabdoa2 commented Dec 28, 2017

Add some i2c commands:

  • i2c_open
  • i2c_close
  • i2c_read_i2c_block_data
  • i2c_read_byte_data
  • i2c_write_byte_data

Fix locking and asyncio sendall calls

@PierreRust
Copy link
Copy Markdown
Owner

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 ?

@jabdoa2
Copy link
Copy Markdown
Contributor Author

jabdoa2 commented Jan 15, 2018

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.

@orbsmiv
Copy link
Copy Markdown

orbsmiv commented Mar 14, 2018

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_write_device 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!

@jabdoa2
Copy link
Copy Markdown
Contributor Author

jabdoa2 commented Mar 14, 2018

@orbsmiv: just create a PR based on my PR. Please also test it.

@orbsmiv
Copy link
Copy Markdown

orbsmiv commented Mar 14, 2018

@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_i2c_commands branch?

@jabdoa2
Copy link
Copy Markdown
Contributor Author

jabdoa2 commented Mar 14, 2018

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

@jabdoa2
Copy link
Copy Markdown
Contributor Author

jabdoa2 commented Oct 4, 2019

@PierreRust any chance we can merge this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants