SPI built-in module

SPI built-in module is available only for product versions from 12.00.xx4 and from 13.00.xx5.

SPI built-in module is an implementation on the Python core of the SPI bus Master based on general purpose input output (GPIO) using the bit-banging technique.

SPI built-in module allows creating one or more SPI bus Python objects on the available GPIO pins. These SPI bus Python objects are each mapped on creation on three GPIO pins that will be dedicated to the Master Input Slave Output, Master Output Slave Input, Serial Clock pins of each SPI bus and optionally on up to 8 other GPIO pins as Chip Select/Slave select pins.

 

If you want to use SPI built-in module you need to import it:

 

import SPI

 

then you can use its methods like in the following example:

 

SPIbus = SPI.new(3, 4, 5, 6, 7)

SPIbus.init(0, 0, 0, 0)

rec = SPIbus.readwrite('test', 4)

 

creates a new SPI bus object using GPIOs 3, 4, 5, 6 and 7, and then sends 'test' and receives a string of 4 bytes assigning it to rec.

More details about SPI built-in module methods can be found in the following paragraphs.