1+ ** API Documentation** for the Transmitter Device Controller
2+
3+ ---
4+
15# TxDevice API Documentation
26
37The ` TxDevice ` class provides a high-level interface for communicating with and
@@ -9,15 +13,11 @@ backend.
913## Initialization
1014
1115``` python
12- from openlifu.io.LIFUHVController import HVController
13- from openlifu.io.LIFUUart import LIFUUart
16+ from openlifu.io.LIFUTXDevice import TxDevice
17+ from openlifu.io.LIFUInterface import LIFUInterface
1418
1519interface = LIFUInterface(TX_test_mode = False )
1620tx_connected, hv_connected = interface.is_device_connected()
17- if tx_connected and hv_connected:
18- print (" LIFU Device Fully connected." )
19- else :
20- print (f " LIFU Device NOT Fully Connected. TX: { tx_connected} , HV: { hv_connected} " )
2121
2222if not tx_connected:
2323 print (" TX Device not connected." )
@@ -35,91 +35,94 @@ if not tx_connected:
3535| ` is_connected() ` | Check if the TX device is connected |
3636| ` ping() ` | Send a ping command to check connectivity |
3737| ` get_version() ` | Get the firmware version (e.g., ` v0.1.1 ` ) |
38- | ` echo(data: bytes) ` | Send and receive echo data to verify communication |
39- | ` toggle_led() ` | Toggle the device onboard LED |
4038| ` get_hardware_id() ` | Return the 16-byte hardware ID in hex format |
41- | ` soft_reset() ` | Perform a software reset on the device |
39+ | ` echo(data: bytes) ` | Send and receive echo data to verify communication |
40+ | ` toggle_led() ` | Toggle the onboard status LED |
41+ | ` soft_reset() ` | Perform a software reset on the TX device |
4242| ` enter_dfu() ` | Put the device into DFU mode |
43+ | ` close() ` | Close the UART connection |
4344
4445---
4546
4647### Trigger Configuration
4748
48- | Method | Description |
49- | ------------------------------------ | ------------------------------------------- |
50- | ` set_trigger(...) ` | Configure triggering with manual parameters |
51- | ` set_trigger_json(data: dict) ` | Set trigger via JSON dictionary |
52- | ` get_trigger() ` | Return current trigger config as a dict |
53- | ` get_trigger_json() ` | Retrieve raw JSON trigger data |
54- | ` start_trigger() ` / ` stop_trigger() ` | Begin or halt triggering |
49+ | Method | Description |
50+ | ------------------------------------ | ------------------------------------------ |
51+ | ` set_trigger(...) ` | Configure trigger with parameters directly |
52+ | ` set_trigger_json(data: dict) ` | Set trigger using JSON config |
53+ | ` get_trigger() ` | Return current trigger config (parsed) |
54+ | ` get_trigger_json() ` | Return raw JSON config from device |
55+ | ` start_trigger() ` / ` stop_trigger() ` | Begin or halt the trigger sequence |
5556
5657---
5758
5859### Register Operations
5960
60- | Method | Description |
61- | --------------------------------------------- | -------------------------------- |
62- | ` write_register(identifier, addr, value )` | Write to a single register |
63- | ` write_register_verify( addr, value)` | Write and verify a register |
64- | ` read_register (addr)` | Read a register value |
65- | ` write_block(identifier, start_addr, values) ` | Write a block of register values |
66- | ` write_block_verify(start_addr, values) ` | Verified block write |
61+ | Method | Description |
62+ | --------------------------------------------- | ------------------------------------------- |
63+ | ` read_register( addr)` | Read a 16-bit register value |
64+ | ` write_register(identifier, addr, value)` | Write a value to a specific register |
65+ | ` write_register_verify (addr, value )` | Write and verify value to a register |
66+ | ` write_block(identifier, start_addr, values) ` | Write a block of register values to a chip |
67+ | ` write_block_verify(start_addr, values) ` | Write and verify a block of register values |
6768
6869---
6970
70- ### Device Setup
71+ ### Device Setup & Control
7172
72- | Method | Description |
73- | ---------------------------------------- | ----------------------------------------- |
74- | ` enum_tx7332_devices(num) ` | Scan for TX7332 devices |
75- | ` demo_tx7332(identifier) ` | Set test waveform to TX7332 |
76- | ` apply_all_registers() ` | Apply all configured profiles to hardware |
77- | ` write_ti_config_to_tx_device(path, id) ` | Load and apply config from TI text file |
78- | ` print ` | Print TX interface info |
73+ | Method | Description |
74+ | ---------------------------------------- | ---------------------------------------------- |
75+ | ` enum_tx7332_devices(num) ` | Enumerate and initialize TX7332 devices |
76+ | ` demo_tx7332(identifier) ` | Set demo waveform to a TX7332 chip |
77+ | ` apply_all_registers() ` | Push all defined register sets to hardware |
78+ | ` write_ti_config_to_tx_device(path, id) ` | Load TI register config from ` .txt ` and apply |
79+ | ` print() ` | Print internal TX state (overridden ` __str__ ` ) |
7980
8081---
8182
8283### Pulse/Delay Profiles
8384
84- | Method | Description |
85- | ---------------------------------------------- | ----------------------------------- |
86- | ` set_solution(pulse, delays, apods, seq, ...) ` | Apply full beamforming config |
87- | ` add_pulse_profile(profile) ` | Add pulse shape settings |
88- | ` add_delay_profile(profile) ` | Add delay+ apodization configuration |
85+ | Method | Description |
86+ | ---------------------------------------------- | ------------------------------------------ |
87+ | ` set_solution(pulse, delays, apods, seq, ...) ` | Apply full beamforming config and sequence |
88+ | ` add_pulse_profile(profile) ` | Add or replace pulse waveform config |
89+ | ` add_delay_profile(profile) ` | Add or replace delay + apodization profile |
8990
9091---
9192
9293## Data Classes
9394
94- - ` Tx7332PulseProfile ` : Defines frequency, cycles, duty cycle, inversion, etc.
95- - ` Tx7332DelayProfile ` : Defines delays and apodization for each channel
96- - ` TxDeviceRegisters ` : Holds and manages TX chip register blocks per transmitter
95+ - ` Tx7332PulseProfile ` : Defines TX waveform: frequency, duration, duty cycle,
96+ inversion, etc.
97+ - ` Tx7332DelayProfile ` : Defines delay + apodization per channel (32 channels
98+ supported)
99+ - ` TxDeviceRegisters ` : Holds per-chip register maps and manages write blocks
100+
101+ ---
102+
103+ ## Notes
104+
105+ - Each register block is managed per TX chip and may need verification.
106+ - Profiles assume 32-channel TX chip configurations.
107+ - Delay units are in seconds, apodization values from 0–1.
108+ - Trigger configuration must be set before ` start_trigger() ` .
97109
98110---
99111
100112## Example
101113
102114``` python
103115pulse = {" frequency" : 3e6 , " duration" : 2e-6 }
104- delays = [0 ] * 32
105- apods = [1 ] * 32
116+ delays = [0.0 ] * 32
117+ apods = [1.0 ] * 32
106118sequence = {
107119 " pulse_interval" : 0.01 ,
108120 " pulse_count" : 1 ,
109121 " pulse_train_interval" : 0.0 ,
110122 " pulse_train_count" : 1 ,
111123}
112124
113- # Apply configuration
114125if tx.is_connected():
115126 tx.set_solution(pulse, delays, apods, sequence)
116127 tx.start_trigger()
117128```
118-
119- ---
120-
121- ## Notes
122-
123- - Profile management assumes 32 transmit channels per chip.
124- - Delay units default to seconds unless specified.
125- - Device must be enumerated before applying register values.
0 commit comments