11.. currentmodule :: machine
22
3- class SPI -- a Serial Peripheral Interface bus protocol
4- =======================================================
3+ class SPI -- a Serial Peripheral Interface bus protocol (master side)
4+ =====================================================================
55
6- SPI is a serial protocol that is driven by a master. At the physical level,
7- bus consistens of 3 lines: SCK, MOSI, MISO. Multiple devices can share the
8- same bus. Each device should have a separate, 4th signal, SS (Slave Select),
9- to select a particualr device on a bus with which communication takes place.
10- Management of an SS signal should happen in user code (via machine.Pin class).
6+ SPI is a synchronous serial protocol that is driven by a master. At the
7+ physical level, a bus consists of 3 lines: SCK, MOSI, MISO. Multiple devices
8+ can share the same bus. Each device should have a separate, 4th signal,
9+ SS (Slave Select), to select a particualr device on a bus with which
10+ communication takes place. Management of an SS signal should happen in
11+ user code (via machine.Pin class).
1112
1213.. only :: port_wipy
1314
@@ -39,7 +40,7 @@ Constructors
3940Methods
4041-------
4142
42- .. method :: SPI.init(baudrate=1000000, \*, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, pins=(CLK, MOSI, MISO), sck=None, mosi=None, miso=None)
43+ .. method :: SPI.init(baudrate=1000000, \*, polarity=0, phase=0, bits=8, firstbit=SPI.MSB, sck=None, mosi=None, miso=None, pins=(SCK, MOSI, MISO) )
4344
4445 Initialise the SPI bus with the given parameters:
4546
@@ -49,12 +50,13 @@ Methods
4950 respectively.
5051 - ``bits `` is the width in bits of each transfer. Only 8 is guaranteed to be supported by all hardware.
5152 - ``firstbit `` can be ``SPI.MSB `` or ``SPI.LSB ``.
52- - ``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
5555 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
57- (``id``=-1).
57+ (``id `` = -1).
58+ - ``pins `` - WiPy port doesn't ``sck ``, ``mosi ``, ``miso `` arguments, and instead allows to
59+ specify them as a tuple of ``pins `` paramter.
5860
5961.. method :: SPI.deinit()
6062
0 commit comments