Skip to content

Commit f12047f

Browse files
committed
docs/machine.SPI: Improve descriptions of xfer methods.
In particular remove the "*" because not all ports support keyword arguments.
1 parent 50ddaaf commit f12047f

File tree

1 file changed

+22
-14
lines changed

1 file changed

+22
-14
lines changed

docs/library/machine.SPI.rst

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -52,42 +52,50 @@ Methods
5252
- ``pins`` is an optional tuple with the pins to assign to the SPI bus (deprecated, only for WiPy).
5353
- ``sck``, ``mosi``, ``miso`` are pins (machine.Pin) objects to use for bus signals. For most
5454
hardware SPI blocks (as selected by ``id`` parameter to the constructore), pins are fixed
55-
and cannot be changed. In some cases, hardware blocks allow 2-3 alterbative pin sets for
55+
and cannot be changed. In some cases, hardware blocks allow 2-3 alternative pin sets for
5656
a hardware SPI block. Arbitrary pin assignments are possible only for a bitbanging SPI driver
5757
(``id``=-1).
5858
5959
.. method:: SPI.deinit()
6060
6161
Turn off the SPI bus.
6262
63-
.. method:: SPI.write(buf)
63+
.. method:: SPI.read(nbytes, write=0x00)
64+
65+
Read a number of bytes specified by ``nbytes`` while continuously writing
66+
the single byte given by ``write``.
67+
Returns a ``bytes`` object with the data that was read.
6468

65-
Write the data contained in ``buf``.
66-
Returns the number of bytes written.
69+
.. method:: SPI.readinto(buf, write=0x00)
6770

68-
.. method:: SPI.read(nbytes, *, write=0x00)
71+
Read into the buffer specified by ``buf`` while continuously writing the
72+
single byte given by ``write``.
73+
Returns ``None``.
6974

70-
Read the ``nbytes`` while writing the data specified by ``write``.
71-
Return the number of bytes read.
75+
Note: on WiPy this function returns the number of bytes read.
7276

73-
.. method:: SPI.readinto(buf, *, write=0x00)
77+
.. method:: SPI.write(buf)
7478

75-
Read into the buffer specified by ``buf`` while writing the data specified by
76-
``write``.
77-
Return the number of bytes read.
79+
Write the bytes contained in ``buf``.
80+
Returns ``None``.
81+
82+
Note: on WiPy this function returns the number of bytes written.
7883

7984
.. method:: SPI.write_readinto(write_buf, read_buf)
8085

81-
Write from ``write_buf`` and read into ``read_buf``. Both buffers must have the
86+
Write the bytes from ``write_buf`` while reading into ``read_buf``. The
87+
buffers can be the same or different, but both buffers must have the
8288
same length.
83-
Returns the number of bytes written.
89+
Returns ``None``.
90+
91+
Note: on WiPy this function returns the number of bytes written.
8492

8593
Constants
8694
---------
8795

8896
.. data:: SPI.MASTER
8997

90-
for initialising the SPI bus to master
98+
for initialising the SPI bus to master; this is only used for the WiPy
9199

92100
.. data:: SPI.MSB
93101

0 commit comments

Comments
 (0)