busio.I2C¶
- class circuitpython_mocks.busio.I2C(scl: Pin, sda: Pin, **kwargs)[source]¶
A mock of
busio.I2Cclass.-
readfrom_into(address: int, buffer: array | bytearray | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, start: int =
0, end: int =9223372036854775807) None[source]¶ A mock imitation of
busio.I2C.readfrom_into.Mock Expectations
This function checks against
I2CReadexpectations.
- scan() list[int][source]¶
Scan all I2C addresses between 0x08 and 0x77 inclusive and return a list of those that respond.
Mock Expectations
This function will check against
I2CScanexpectations.
- try_lock() bool¶
Attempt to grab the lock. Return
Trueon success,Falseif the lock is already taken.
-
writeto(address: int, buffer: array | bytearray | bytes | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, start: int =
0, end: int =9223372036854775807) None[source]¶ A mock imitation of
busio.I2C.writeto.Mock Expectations
This function checks against
I2CWriteexpectations.
-
writeto_then_readfrom(address: int, 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 mock imitation of
busio.I2C.writeto_then_readfrom.Mock Expectations
This function checks against
I2CTransferexpectations.
-
readfrom_into(address: int, buffer: array | bytearray | memoryview | rgbmatrix.RGBMatrix | ulab.numpy.ndarray, *, start: int =
I2C operations¶
- class circuitpython_mocks.busio.operations.I2CRead(address: int, response: bytearray)[source]¶
A class to identify a read operation over a
I2Cbus.
- class circuitpython_mocks.busio.operations.I2CWrite(address: int, expected: bytearray)[source]¶
A class to identify a write operation over a
I2Cbus.