busio.SPI

class circuitpython_mocks.busio.SPI(clock: Pin, MOSI: Pin, MISO: Pin, **kwargs)[source]

A mock of busio.SPI class.

configure(*, baudrate: int = 100000, polarity: int = 0, phase: int = 0, bits: int = 8) None[source]

A dummy function to mock busio.SPI.configure

deinit() None

Free any hardware used by the object.

property frequency : int

Returns the value passed to baudrate parameter of configure().

readinto(buffer: array | bytearray | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, start: int = 0, end: int = 9223372036854775807, write_value: int = 0) None[source]

A function that mocks busio.SPI.readinto.

Mock Expectations

This function checks against SPIRead expectations.

try_lock() bool

Attempt to grab the lock. Return True on success, False if the lock is already taken.

unlock() None

Release the lock so others may use the resource.

write(buffer: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, start: int = 0, end: int = 9223372036854775807) None[source]

A function that mocks busio.SPI.write.

Mock Expectations

This function checks against SPIWrite expectations.

write_readinto(out_buffer: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, in_buffer: array | bytearray | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, out_start: int = 0, out_end: int = 9223372036854775807, in_start: int = 0, in_end: int = 9223372036854775807) None[source]

A function that mocks busio.SPI.write_readinto.

Mock Expectations

This function checks against SPITransfer expectations.

SPI operations

class circuitpython_mocks.busio.operations.SPIRead(response: bytearray, **kwargs)[source]

A class to identify a read operation over a SPI bus.

class circuitpython_mocks.busio.operations.SPIWrite(expected: bytearray, **kwargs)[source]

A class to identify a write operation over a SPI bus.

class circuitpython_mocks.busio.operations.SPITransfer(expected: bytearray, response: bytearray, **kwargs)[source]

A class to identify a read/write (transfer) operation over a SPI bus.