read(into:count:from:)

Reads bytes from the specified slave device with the given address and store them in the buffer.

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

Parameters

buffer

An array to store the received data.

count

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

address

The address of the slave device to communicate with.

Returns

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