Spi Class
This file defines the SPI interface for libmraa
Methods
Spi
-
bus
Initialise SPI object using the board mapping to set muxes
Parameters:
-
bus
Numberto use, as listed in the platform definition, normally 0
Returns:
Spi
-
bus
-
cs
Initialise SPI object using 'raw' mode. Mraa will go and grab the spidev device lablled /dev/spidev[bus].[cs]
Parameters:
-
bus
Numberto use
-
cs
Numberto use
Returns:
mode
-
mode
Set the SPI device mode. see spidev0-3
Parameters:
-
mode
Enum Spi_Modethe mode. See Linux spidev doc
Returns:
Result of operation
frequency
-
hz
Set the SPI device operating clock frequency
Parameters:
-
hz
Numberthe frequency to set in hz
Returns:
Result of operation
writeByte
-
data
Write single byte to the SPI device
Parameters:
-
data
Numberthe byte to send
Returns:
data received on the miso line or -1 in case of error
writeWord
-
data
Write single byte to the SPI device
Parameters:
-
data
Numberthe byte to send
Returns:
data received on the miso line or -1 in case of error
lsbmode
-
lsb
Change the SPI lsb mode
Parameters:
-
lsb
BooleanUse least significant bit transmission - 0 for msbi
Returns:
Result of operation
bitPerWord
-
bits
Set bits per mode on transaction, default is 8
Parameters:
-
bits
Numberbits per word
Returns:
Result of operation