Skip to content

docs/library/machine.I2C.rst: Extend writeto to support a list of bufs. #4020

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions docs/library/machine.I2C.rst
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,15 @@ operations that target a given slave device.

The method returns ``None``.

.. method:: I2C.writeto(addr, buf, stop=True)
.. method:: I2C.writeto(addr, data, stop=True)

Write the bytes from *buf* to the slave specified by *addr*. If a
NACK is received following the write of a byte from *buf* then the
Write the bytes from *data* to the slave specified by *addr*.
*data* can be an object with the buffer protocol (eg ``bytes`` or ``bytearray``),
or a tuple or list of objects with the buffer protocol. In the latter case the
*addr* is sent once and then the bytes from each object are written out
sequentially.

If a NACK is received following the write of a byte from *data* then the
remaining bytes are not sent. If *stop* is true then a STOP condition is
generated at the end of the transfer, even if a NACK is received.
The function returns the number of ACKs that were received.
Expand Down