@@ -52,42 +52,50 @@ Methods
52
52
- ``pins `` is an optional tuple with the pins to assign to the SPI bus (deprecated, only for WiPy).
53
53
- ``sck ``, ``mosi ``, ``miso `` are pins (machine.Pin) objects to use for bus signals. For most
54
54
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
56
56
a hardware SPI block. Arbitrary pin assignments are possible only for a bitbanging SPI driver
57
57
(``id``=-1).
58
58
59
59
.. method:: SPI.deinit()
60
60
61
61
Turn off the SPI bus.
62
62
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.
64
68
65
- Write the data contained in ``buf ``.
66
- Returns the number of bytes written.
69
+ .. method :: SPI.readinto(buf, write=0x00)
67
70
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 ``.
69
74
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.
72
76
73
- .. method :: SPI.readinto (buf, *, write=0x00 )
77
+ .. method :: SPI.write (buf)
74
78
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.
78
83
79
84
.. method :: SPI.write_readinto(write_buf, read_buf)
80
85
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
82
88
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.
84
92
85
93
Constants
86
94
---------
87
95
88
96
.. data :: SPI.MASTER
89
97
90
- for initialising the SPI bus to master
98
+ for initialising the SPI bus to master; this is only used for the WiPy
91
99
92
100
.. data :: SPI.MSB
93
101
0 commit comments