read(into:count:)

Reads an array of data from the slave device.

SPI.swift:379
@discardableResult func read(into buffer: inout [UInt8], count: Int? = nil) -> Result<(), Errno>

Parameters

buffer

A UInt8 array to store the received bytes.

count

The number of bytes to read. Make sure it doesn’t exceed the length of the buffer. If it’s nil, the number equals the length of the buffer.

Returns

Whether the communication succeeds. If not, it returns the specific error.