• Damien George's avatar
    docs/machine.I2C: Add writevto method to write a vector of byte bufs. · 8bec0e86
    Damien George authored
    This allows to efficiently send to an I2C slave data that is made up of
    more than one buffer.  Instead of needing to allocate temporary memory to
    combine buffers together this new method allows to pass in a tuple or list
    of buffers.  The name is based on the POSIX function writev() which has
    similar intentions and signature.
    
    The reasons for taking this approach (compared to having an interface with
    separate start/write/stop methods) are:
    - It's a backwards compatible extension.
    - It's convenient for the user.
    - It's efficient because there is only one Python call, then the C code can
      do everything in one go.
    - It's efficient on the I2C bus because the implementation can do
      everything in one go without pauses between blocks of bytes.
    - It should be possible to implement this extension in all ports, for
      hardware and software I2C.
    
    Further discussion is found in issue #3482, PR #4020 and PR #4763.
    8bec0e86
machine.I2C.rst 7.07 KB