Aardvark#
- class Aardvark(serial_number: str | None = None)[source]#
Bases:
I2CDriverBaseTotal Phase Aardvark I2C/SPI host adapter. Connection params captured in
__init__; USB opens onopen().serial_number(e.g."2239-764425");Noneletspyaardvarkpick the first available adapter.Methods
Close the adapter handle.
Open the adapter (typically a USB host adapter) and prepare it for transactions.
Read
lengthbytes from the 7-bitaddress(master read transaction).Set the master clock rate in kHz.
Enable or disable target-power output on the adapter (where supported).
Enable or disable the adapter's internal bus pull-ups (typical: ~10 kΩ to VCC).
Write
datato the 7-bitaddress(master write transaction).Write
datathen immediately readread_lenbytes fromaddressusing a repeated START.- open() None[source]#
Open the adapter (typically a USB host adapter) and prepare it for transactions.
- read(address: int, length: int) bytes[source]#
Read
lengthbytes from the 7-bitaddress(master read transaction).
- write(address: int, data: bytes) None[source]#
Write
datato the 7-bitaddress(master write transaction).
- write_read(address: int, data: bytes, read_len: int) bytes[source]#
Write
datathen immediately readread_lenbytes fromaddressusing a repeated START.Used for register reads: write the register address, then read its contents without releasing the bus. No STOP is issued between the write and the read.
- set_bitrate(bitrate: int) None[source]#
Set the master clock rate in kHz. Drivers may snap to the nearest supported rate.