This SPI bus Python object method initializes the SPI bus.
The first input parameter CPOL is a Python byte, represents Clock polarity and can have the following values:
0 for polarity low;
1 for polarity high.
The second input parameter CPHA is a Python byte, represents Clock phase transmission and can have the following values:
0 for data bit clocked/latched on the first edge of SCLK;
1 for data bit clocked/latched on the second edge of SCLK
The third optional parameter <SSPOL> is a Python byte, represents the Slave Select polarity and can have the following values:
0 for polarity low (default value if omitted);
1 for polarity high.
The fourth optional parameter <SS> is a Python byte, represents the default Slave Select line number to be used among those linked to the SPI bus Python object at its creation and can have values from 0 to 7.
Default behavior if omitted is that, unless SS parameter present in readwrite, no SS line will be used.
Behavior if present is that, unless SS parameter present in readwrite, this SS line will be used.
The return value is a Python integer, which is -1 if an error occurred, otherwise is 1.
Example:
SPIbus.init(0, 0, 0)
initializes SPI bus object: no SS line is defined as default and no SS line will be used unless set in readwrite.
SPIbus.init(0, 0, 0, 1)
initializes SPI bus object: SS line 1 is defined as default and second SS line assigned in SPI.new will be used unless set in readwrite.