Aardvark#

class Aardvark(serial_number: str | None = None)[source]#

Bases: I2CDriverBase

Total Phase Aardvark I2C/SPI host adapter. Connection params captured in __init__; USB opens on open().

serial_number (e.g. "2239-764425"); None lets pyaardvark pick the first available adapter.

Methods

close

Close the adapter handle.

open

Open the adapter (typically a USB host adapter) and prepare it for transactions.

read

Read length bytes from the 7-bit address (master read transaction).

set_bitrate

Set the master clock rate in kHz.

set_power_enable

Enable or disable target-power output on the adapter (where supported).

set_pullups

Enable or disable the adapter's internal bus pull-ups (typical: ~10 kΩ to VCC).

write

Write data to the 7-bit address (master write transaction).

write_read

Write data then immediately read read_len bytes from address using a repeated START.

open() → None[source]#

Open the adapter (typically a USB host adapter) and prepare it for transactions.

close() → None[source]#

Close the adapter handle. Idempotent.

read(address: int, length: int) → bytes[source]#

Read length bytes from the 7-bit address (master read transaction).

write(address: int, data: bytes) → None[source]#

Write data to the 7-bit address (master write transaction).

write_read(address: int, data: bytes, read_len: int) → bytes[source]#

Write data then immediately read read_len bytes from address using 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.

set_pullups(enable: bool) → None[source]#

Enable or disable the adapter’s internal bus pull-ups (typical: ~10 kΩ to VCC).

set_power_enable(enable: bool) → None[source]#

Enable or disable target-power output on the adapter (where supported).