This command creates a new SPI bus Python object linked to given GPIO pins.
The first three input parameter SCLK_pin, MOSI_pin and MISO_pin are Python bytes, which are the GPIO pin numbers the SCLK (Serial CLocK), MOSI (Master Output Slave Input) and MISO (Master Input Slave Output) lines are mapped to.
The following up to 8 optional parameters <SSi> are Python bytes, which are the GPIO pin numbers the SSi (ith Slave Select) lines are mapped to. The SSi parameter are optional because not all SPI devices have a Slave Select (SS) line, called Chip Select (CS) line as well. The SSi parameters must be used for those SPI devices that needs to be selected by Slave Select line.
The return value is the SPI bus Python object which shall then be used to interface to the SPI bus device.
|
|
Note: All GPIO pins are available pins for the SPI bus. |
It is Python script developer responsibility to avoid conflicts between GPIO pins, no automatic check of GPIO pins already used for other purposes (GPIO module, IIC module, SPI module) is available.
Example:
SPIbus = SPI.new(3, 4, 5, 6, 7)
creates a new SPI bus object using GPIO 3 for SCLK, GPIO 4 for MOSI, GPIO 5 for MISO, GPIO 6 for SS0, GPIO 7 for SS1.