Import
Methods
Method Reference
Net.get(name, type=NetType.SPI)
Get an SPI net by name.
Returns: SPI Net instance
config(mode, bit_order, frequency_hz, word_size, cs_active, cs_mode)
Configure SPI bus parameters. Only explicitly-provided parameters are changed; omitted parameters retain their stored values.
SPI Modes
read(n_words, fill, keep_cs, output_format)
Read data from an SPI device. Sends fill bytes while receiving data (full duplex).
Returns:
list[int] - Received words as integers (when output_format="list")
read_write(data, keep_cs, output_format)
Perform simultaneous full-duplex SPI read and write. Sends data while simultaneously receiving the response.
Returns:
list[int] - Received words (same length as transmitted data)
transfer(n_words, data, fill, keep_cs, output_format)
Perform SPI transfer with automatic padding or truncation. If data is shorter than n_words, it is padded with the fill value. If longer, it is truncated.
Returns:
list[int] - Received words
write(data, keep_cs)
Write data to an SPI device, discarding the response. Convenience method for write-only operations.
get_config()
Get the raw net configuration dictionary.
dict - Full net configuration including name, role, instrument, and params
Output Formats
Theoutput_format parameter controls how data is returned. Hex formatting is word-size-aware:
Examples
Read SPI Flash JEDEC ID
Read Flash Memory
Multi-Part Transaction with keep_cs
Write to SPI Flash
16-bit Word Mode
Supported Hardware
Notes
- Net must be configured as
NetType.SPI - All SPI operations are full duplex; data is sent and received simultaneously
write()performs a full-duplex transfer but discards the received datakeep_cs=Trueholds the chip select line asserted between calls for multi-part transactionstransfer()pads short data arrays with the fill value or truncates long arrays ton_words- LabJack T7 supports up to 56 bytes per transaction and a maximum of approximately 800 kHz
- Aardvark uses GPIO bit-bang mode; actual speed is limited by USB round-trip time regardless of
frequency_hz - Configuration changes persist to
saved_nets.jsonfor subsequent commands - LSB-first mode (
bit_order="lsb") uses software bit reversal on LabJack T7

