Skip to main content

spi.read(1)

Return last byte read from the SPI port

Availability

Device
DEPRECATED METHOD — DO NOT USE IN NEW CODE

Parameters

Name Type Description
1 Constant Must be 1

Returns

Integer — the last byte read

Description

This method returns the last byte read on the SPI port. It is deprecated because arguments other than 1 never worked, and because spi.writeread() is a less confusing way of doing what is inherently a simultaneous write and read.

Before spi.writeread() was invented, multi-byte combined write and read had to be done using a sequence of spi.write() with a one-byte string passed as a parameter, and spi.read(1). This was a workaround for a bug, and new projects should just use spi.writeread().

Although this method is deprecated, removing it altogether would cause some users' existing code to stop working, so we currently have no plans to do so. However, please note that spi.read(1) is not supported on the imp004m module, so existing code which make use of this call will need to be updated to run on the imp004m, otherwise an ‘index not found’ error will be thrown.

Note This method has been removed from versions of impOS running on the impC001.