Specifications
This function returns a string containing the actual bytes received.
More background information on using SPI is in section 6.
spiWrite(byteStr, bitsInLastByte=8) – SPI Bus Write
This function can only be used after function spiInit() has been called.
This function writes data to a three or four wire SPI device. If you want to write and read data
simultaneously (four wire SPI only), then you should be using the bidirectional function spiXfer()
instead of this one).
Parameter byteStr specifies the actual bytes to be shifted out.
Parameter bitsInLastByte makes it possible to accommodate devices with data widths like 12 bits. The
default value of bitsInLastByte is 8. For a device with a data width of 12 bits, bitsInLastByte would be
set to 4. For a device with a data width of 31 bits, bitsInLastByte would be set to 7.
The order that bits get shifted out depends on the value of parameter isMsbFirst which was specified
in the previous spiInit() call.
This function does not return a value.
More background information on using SPI is in section 6.
spiXfer(byteStr, bitsInLastByte=8) – Bidirectional SPI Transfer
This function can only be used after function spiInit() has been called.
This function reads and writes data over a four wire SPI device. If your device is read-only or write-
only, you should look at the spiRead() and spiWrite() routines.
Parameter byteStr specifies the actual bytes to be shifted out.
As these bits are being shifted out to the slave device (on the MOSI pin), bits from the slave device (on
the MISO pin) are simultaneously shifted in.
Parameter bitsInLastByte makes it possible to accommodate devices with data widths like 12 bits. The
default value of bitsInLastByte is 8. For a device with a data width of 12 bits, bitsInLastByte would be
set to 4. For a device with a data width of 31 bits, bitsInLastByte would be set to 7.
The order
that bits get shifted in and out depends on the value of parameter isMsbFirst which was
specified in the previous spiInit() call.
Page 76 of 202 SNAP Reference Manual Document Number 600-0007K