SpiDevice
Description
The SpiDevice object represents a generic SPI device operating on a parent SpiBus object. Data can be written to an SPI slave at address address using write() and read from an SPI slave using read().
Overview
Properties
Methods
Signals
Properties
address
This property holds the bus address of the SPI device. It’s up to the actual SpiBus implementation to select the corresponding slave.
- › Type:
UnsignedInteger
- › Default:
0- › Signal:
addressChanged()
- › Attributes:
Writable
Methods
read(UnsignedInteger bytes)
This method reads the specified number of bytes from the SPI slave. Returns an empty buffer if the transfer failed.
- › Returns:
ArrayBuffer
transfer(ArrayBuffer data)
This method transfers the specified bytes to the SPI slave and returns the received bytes (or empty data if transfer failed).
- › Returns:
ArrayBuffer
write(ArrayBuffer data)
This method writes the specified bytes to the SPI slave. Returns false if the transfer failed.
- › Returns:
Boolean