Simulator
This function needs real hardware to work with. It’s not supported in the simulator.
Set the Serial Peripheral Interface (SPI) format.
pins.spiFormat(8, 3);
The data sent over a SPI connection has a number of bits to represent each value. Also, position of the clock signal (SCK), high
or low
, and the exact time when a data value is read is determined by the SPI mode. Both the bits and mode values together are called the SPI format.
This function needs real hardware to work with. It’s not supported in the simulator.
The default number of bits is 8
and the default mode value is 3
.
8
since only 8 bits is currently supported for SPI data values.
0
: the data line is active when SCK goes tohigh
and the data values are read when SCK goes tohigh
1
: the data line is active when SCK goes tohigh
and the data values are read when SCK goes tolow
2
: the data line is active when SCK goes tolow
and the data values are read when SCK goes tohigh
3
: the data line is active when SCK goes tolow
and the data values are read when SCK goes tolow
Set the pins and format for the SPI connection.
pins.spiPins(DigitalPin.P15, DigitalPin.P14, DigitalPin.P13);
pins.spiFormat(8, 3);