ariel-tcu 0.17.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1389 @@
1
+ """Utility functions to build the TCU command strings.
2
+
3
+ We discern between the following types of commands:
4
+ - General commands;
5
+ - M2MD commands (on a per-axis basis);
6
+ - Thermal Monitoring System (TSM) commands;
7
+ - HK commands.
8
+
9
+ Reference documents:
10
+ - RD01: TCU User Manual (ARIEL-IEEC-PL-TN-002), v1.2
11
+ - RD02: ARIEL TCU Data Handling (ARIEL-IEEC-PL-TN-007), v1.0
12
+ - RD03: TCU code provided by Vladimiro Noce (priv. comm.)
13
+ - RD04: ARIEL Telescope Control Unit Design Description Document (ARIEL-IEEC-PL-DD-001), v1.10
14
+ - RD05: ARIEL TCU FW Architecture Design(ARIEL-IEEC-PL-DD-002), v1.5
15
+ """
16
+
17
+ from enum import StrEnum
18
+ import crcmod
19
+
20
+ from egse.ariel.tcu import TcuMode
21
+ from egse.decorators import static_vars
22
+
23
+ TCU_LOGICAL_ADDRESS = "03" # RD02 -> Fig. 10
24
+ DATA_LENGTH = "0004" # Vladimiro's code
25
+
26
+
27
+ class PacketType(StrEnum):
28
+ """Packet types (read/write)."""
29
+
30
+ W = WRITE = "20" # Write command (RD02 -> Sect. 4.1.1)
31
+ R = READ = "40" # Read command (RD02 -> Sect. 4.1.2)
32
+
33
+
34
+ class CommandAddress(StrEnum):
35
+ """Identifiers of the components of the TCU the commands have to be sent to."""
36
+
37
+ # Adopted from Vladimiro's code
38
+
39
+ GENERAL = "0000" # General TCU commands -> see `show_messageGEN`, where the command string is built
40
+ M2MD_1 = "0001" # M2MD axis-1 commands -> see `show_messageM2M`, where the command string is built
41
+ M2MD_2 = "0002" # M2MD axis-2 commands -> see `show_messageM2M`, where the command string is built
42
+ M2MD_3 = "0003" # M2MD axis-3 commands -> see `show_messageM2M`, where the command string is built
43
+ TSM = "0004" # TSM commands -> see `show_messageTSM`, where the command string is built
44
+ HK = "0005" # HK commands -> see `show_messageHK`, where the command string is built
45
+
46
+
47
+ #####################
48
+ # Command identifiers
49
+ #####################
50
+
51
+
52
+ class GeneralCommandIdentifier(StrEnum):
53
+ """Identifiers for the general TCU commands."""
54
+
55
+ # Adopted from Vladimiro's code
56
+
57
+ TCU_FIRMWARE_ID = "0000" # Read
58
+ TCU_MODE = "0001" # Read/Write
59
+ TCU_STATUS = "0002" # Read
60
+ TCU_SIMULATED = "0003" # Write
61
+ RESTART_LINKS_PERIOD_LATCH = "0004" # Write
62
+ RESTART_LINKS_PERIOD = "0005" # Read/Write
63
+
64
+
65
+ class M2MDCommandIdentifier(StrEnum):
66
+ """Identifiers for the M2MD commands."""
67
+
68
+ # Adopted from Vladimiro's code
69
+
70
+ OPE_MNG_COMMAND = "0000" # Write
71
+ OPE_MNG_EVENT_CLEAR_PROTECT_FLAG = "0001" # Write
72
+ OPE_MNG_EVENT_CLEAR = "0002" # Write
73
+ OPE_MNG_STATUS = "0003" # Read
74
+ OPE_MNG_EVENT_REG = "0004" # Read
75
+ ACQ_CURR_OFF_CORR = "1000" # Read/Write
76
+ ACQ_CURR_GAIN_CORR = "1001" # Read/Write
77
+ ACQ_AXIS_A_CURR_READ = "1002" # Read
78
+ ACQ_AXIS_B_CURR_READ = "1003" # Read
79
+ ACQ_AVE_LPF_EN = "1004" # Write
80
+ ACQ_OVC_CFG_FILTER = "1005" # Write
81
+ ACQ_AVC_FILT_TIME = "1006" # Write
82
+ ACQ_AVERAGE_TYPE = "1007" # Write
83
+ ACQ_SPK_FILT_COUNTER_LIM = "1008" # Write
84
+ ACQ_SPK_FILT_INCR_THR = "1009" # Write
85
+ PROF_GEN_AXIS_STEP = "2000" # Read/Write
86
+ PROF_GEN_AXIS_SPEED = "2001" # Read/Write
87
+ PROF_GEN_AXIS_STATE_START = "2002" # Read/Write
88
+ SW_RS_XX_SW_RISE = "3001" # Read
89
+ # TODO Check whether this is correct:
90
+ # This is how it is hard-coded in Vladimiro's code, but in his `show_messageM2M` function, he states that there's
91
+ # an offset of 20 between SW_RS_XX_SW_RISE and SW_RS_XX_SW_FALL (where position must in 1,...,20). That would mean
92
+ # that for position 15, SW_RS_XX_SW_RISE is 3015, which clashes with the hard-coded value for
93
+ # SW_RS_XX_SW_FALL.
94
+ SW_RS_XX_SW_FALL = "3015" # Read
95
+
96
+
97
+ class TSMCommandIdentifier(StrEnum):
98
+ """Identifiers for the TSM commands."""
99
+
100
+ TSM_LATCH = "0000" # Write
101
+ TSM_CURRENT_VALUE = "0001" # Read/Write
102
+ TSM_CURRENT_OFFSET = "0002" # Read/Write
103
+ TSM_ADC_REGISTER_LATCH = "1000" # Write
104
+ TSM_ADC_ID_REGISTER = "1001" # Read
105
+ TSM_ADC_CONFIGURATION_REGISTER = "1002" # Read
106
+ TSM_ADC_HPF_REGISTER = "1003" # Read/Write
107
+ TSM_ADC_OFC_REGISTER = "1004" # Read/Write
108
+ TSM_ADC_FSC_REGISTER = "1006" # Read/Write
109
+ TSM_ADC_COMMAND_LATCH = "1008" # Write
110
+ TSM_ADC_COMMAND = "1009" # Write
111
+ TSM_ADC_CALIBRATION = "100A" # Write
112
+ TSM_ADC_VALUE_XX_CURRENTN = "2000" # Read
113
+ TSM_ADC_VALUE_XX_BIASN = "2001" # Read
114
+ TSM_ADC_VALUE_XX_CURRENTP = "2002" # Read
115
+ TSM_ADC_VALUE_XX_BIASP = "2003" # Read
116
+ TSM_ACQ_COUNTER = "20C0" # Read
117
+
118
+
119
+ class HKCommandIdentifier(StrEnum):
120
+ """Identifiers for the HK commands."""
121
+
122
+ # Adopted from Vladimiro's code
123
+
124
+ VHK_PSU_VMOTOR = "0000" # Read
125
+ VHK_PSU_VHI = "0001" # Read
126
+ VHK_PSU_VLOW = "0002" # Read
127
+ VHK_PSU_VMEDP = "0003" # Read
128
+ VHK_PSU_VMEDN = "0004" # Read
129
+ IHK_PSU_VMEDN = "0005" # Read
130
+ IHK_PSU_VMEDP = "0006" # Read
131
+ IHK_PSU_VLOW = "0007" # Read
132
+ IHK_PSU_VHI = "0008" # Read
133
+ IHK_PSU_VMOTOR = "0009" # Read
134
+ THK_PSU_FIRST = "000A" # Read
135
+ THK_M2MD_FIRST = "000B" # Read
136
+ THK_PSU_SECOND = "000C" # Read
137
+ THK_M2MD_SECOND = "000D" # Read
138
+ THK_CTS_Q1 = "000E" # Read
139
+ THK_CTS_Q2 = "000F" # Read
140
+ THK_CTS_Q3 = "0010" # Read
141
+ THK_CTS_Q4 = "0011" # Read
142
+ THK_CTS_FPGA = "0012" # Read
143
+ THK_CTS_ADS1282 = "0013" # Read
144
+ VHK_THS_RET = "0014" # Read
145
+ HK_ACQ_COUNTER = "0015" # Read
146
+
147
+
148
+ def get_tsm_adc_value_xx_currentn_cmd_id(probe: int) -> str:
149
+ """Determines the command identifier for the TSM_ADC_VALUE_XX_CURRENTN for the given probe.
150
+
151
+ Args:
152
+ probe (int): Thermistor identifier.
153
+
154
+ Returns:
155
+ Command identifier for the TSM_ADC_VALUE_XX_CURRENTN for the given probe.
156
+ """
157
+
158
+ return get_tsm_adc_value_xx_cmd_id(TSMCommandIdentifier.TSM_ADC_VALUE_XX_CURRENTN, probe)
159
+
160
+
161
+ def get_tsm_adc_value_xx_biasn_cmd_id(probe: int) -> str:
162
+ """Determines the command identifier for the TSM_ADC_VALUE_XX_BIASN for the given probe.
163
+
164
+ Args:
165
+ probe (int): Thermistor identifier.
166
+
167
+ Returns:
168
+ Command identifier for the TSM_ADC_VALUE_XX_BIASN for the given probe.
169
+ """
170
+
171
+ return get_tsm_adc_value_xx_cmd_id(TSMCommandIdentifier.TSM_ADC_VALUE_XX_BIASN, probe)
172
+
173
+
174
+ def get_tsm_adc_value_xx_currentp_cmd_id(probe: int) -> str:
175
+ """Determines the command identifier for the TSM_ADC_VALUE_XX_CURRENTP for the given probe.
176
+
177
+ Args:
178
+ probe (int): Thermistor identifier.
179
+
180
+ Returns:
181
+ Command identifier for the TSM_ADC_VALUE_XX_CURRENTP for the given probe.
182
+ """
183
+
184
+ return get_tsm_adc_value_xx_cmd_id(TSMCommandIdentifier.TSM_ADC_VALUE_XX_CURRENTP, probe)
185
+
186
+
187
+ def get_tsm_adc_value_xx_biasp_cmd_id(probe: int) -> str:
188
+ """Determines the command identifier for the TSM_ADC_VALUE_XX_BIASP for the given probe.
189
+
190
+ Args:
191
+ probe (int): Thermistor identifier.
192
+
193
+ Returns:
194
+ Command identifier for the TSM_ADC_VALUE_XX_BIASP for the given probe.
195
+ """
196
+
197
+ return get_tsm_adc_value_xx_cmd_id(TSMCommandIdentifier.TSM_ADC_VALUE_XX_BIASP, probe)
198
+
199
+
200
+ def get_tsm_adc_value_xx_cmd_id(tsm_cmd_id: TSMCommandIdentifier | str, probe: int):
201
+ """Determines the command identifier for the given TSM_ADC_VALUE_XX for the given probe.
202
+
203
+ Args:
204
+ tsm_cmd_id (TSMCommandIdentifier | str): TSM command identifier.
205
+ probe (int): Thermistor identifier.
206
+
207
+ Returns:
208
+ Command identifier for the
209
+ TSM_ADC_VALUE_XX_CURRENTN/TSM_ADC_VALUE_XX_BIASN/TSM_ADC_VALUE_XX_CURRENTP/TSM_ADC_VALUE_XX_BIASP for the given
210
+ probe.
211
+ """
212
+
213
+ # Adopted from Vladimiro's code
214
+ return tsm_cmd_id.value[:2] + hex(probe * 4 + int(tsm_cmd_id.value[-1]))[2:].zfill(2)
215
+
216
+
217
+ def get_sw_rs_xx_sw_cmd_id(cmd_identifier: M2MDCommandIdentifier, position: int) -> str:
218
+ """Determines the command identifier for the given SW_RS_XX_SW for the given probe.
219
+
220
+ Args:
221
+ cmd_identifier (M2MDCommandIdentifier): TSM command identifier.
222
+ position (int):
223
+
224
+ Returns:
225
+ Command identifier for the SW_RS_XX_SW_RISE/SW_RS_XX_SW_FALL for the given probe.
226
+ """
227
+
228
+ # Adopted from Vladimiro's code
229
+ return f"{cmd_identifier.value[:2]}{hex(position)[2:].zfill(2)}"
230
+
231
+
232
+ ##############################
233
+ # Building the command strings
234
+ ##############################
235
+
236
+
237
+ def format_value(value: int | str | StrEnum) -> str:
238
+ """Formats the given value to a 4-digit hex string without leading "0x".
239
+
240
+ Args:
241
+ value (int | str | StrEnum): Value to format.
242
+
243
+ Returns:
244
+ str: Formatted value.
245
+ """
246
+
247
+ if isinstance(value, StrEnum):
248
+ value = value.value
249
+ if isinstance(value, int):
250
+ value = f"0x{value:X}" # Integer -> Hex string
251
+ if value.startswith("0x"): # Strip off leading 0x
252
+ value = value[2:]
253
+ return value.zfill(4)
254
+
255
+
256
+ def _create_write_cmd_string(
257
+ cmd_address: CommandAddress | str | int,
258
+ cmd_identifier: GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier | str,
259
+ cargo1: int = 0,
260
+ cargo2: int = 0,
261
+ ) -> str:
262
+ """Creates a write-command string to send to the TCU Arduino.
263
+
264
+ Note that this function should not be called directly in the `@dynamic_command` decorator (in the `cmd_string`
265
+ attribute), as this will increase the transaction identifier without actually calling the function (merely
266
+ importing the interface in which such a decorator call is made will increase the transaction identifier)..
267
+
268
+ Args:
269
+ cmd_address (CommandAddress | str | int): Identifier of the commanded device.
270
+ cmd_identifier (GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier):
271
+ Command identifier, internal to the commanded device.
272
+ cargo1 (int): Reference to the first 16-bit cargo word.
273
+ cargo2 (int): Reference to the second 16-bit cargo word.
274
+
275
+ Returns:
276
+ Write-command string to send to the TCU Arduino.
277
+ """
278
+
279
+ return _create_cmd_string(PacketType.WRITE, cmd_address, cmd_identifier, cargo1, cargo2)
280
+
281
+
282
+ def _create_read_cmd_string(
283
+ cmd_address: CommandAddress | str | int,
284
+ cmd_identifier: GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier | str,
285
+ cargo1: int = 0,
286
+ cargo2: int = 0,
287
+ ) -> str:
288
+ """Creates a read-command string to send to the TCU Arduino.
289
+
290
+ Note that this function should not be called directly in the `@dynamic_command` decorator (in the `cmd_string`
291
+ attribute), as this will increase the transaction identifier without actually calling the function (merely
292
+ importing the interface in which such a decorator call is made will increase the transaction identifier)..
293
+
294
+ Args:
295
+ cmd_address (CommandAddress | str | int): Identifier of the commanded device.
296
+ cmd_identifier (GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier):
297
+ Command identifier, internal to the commanded device.
298
+ cargo1 (int): Reference to the first 16-bit cargo word.
299
+ cargo2 (int): Reference to the second 16-bit cargo word.
300
+
301
+ Returns:
302
+ Read-command string to send to the TCU Arduino.
303
+ """
304
+
305
+ return _create_cmd_string(PacketType.READ, cmd_address, cmd_identifier, cargo1, cargo2)
306
+
307
+
308
+ @static_vars(transaction_id=-1)
309
+ def _create_cmd_string(
310
+ packet_type: PacketType,
311
+ cmd_address: CommandAddress | str | int,
312
+ cmd_identifier: GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier | str,
313
+ cargo1: int = 0,
314
+ cargo2: int = 0,
315
+ ) -> str:
316
+ """Creates a command string to send to the TCU Arduino.
317
+
318
+ Packet format (text):
319
+ "03XX TTTT 0004 AAAA BBBB CCCC DDDD CRC"
320
+ with:
321
+ - 03: TCU logical address;
322
+ - XX: Indicates whether it's a read (40) or write (20) command (without reply);
323
+ - TTTT: Transaction identifier (basically a counter that increments for each command call);
324
+ - 0004: Data length (always 4 bytes);
325
+ - AAAA: Identifier of the commanded device:
326
+ - 0000: General commands;
327
+ - 0001: M2MD axis-1 commands;
328
+ - 0002: M2MD axis-2 commands;
329
+ - 0003: M2MD axis-3 commands;
330
+ - 0020: TSM commands;
331
+ - BBBB: Command identifier, internal to the commanded device;
332
+ - CCCC: First 16-bit cargo word;
333
+ - DDDD: Second 16-bit cargo word;
334
+ - CRC: Cyclic Redundancy Check (CRC-16), determined from the packet string.
335
+
336
+ Note that this function should not be called directly in the `@dynamic_command` decorator (in the `cmd_string`
337
+ attribute), as this will increase the transaction identifier without actually calling the function (merely
338
+ importing the interface in which such a decorator call is made will increase the transaction identifier)..
339
+
340
+ Args:
341
+ packet_type (PacketType): Type of the packet (read or write).
342
+ cmd_address (CommandAddress): Identifier of the commanded device. In case of a M2MD axis, it is the reference
343
+ to the axis (typically "${axis}") rather than the axis identifier enumeration.
344
+ cmd_identifier (GeneralCommandIdentifier | TSMCommandIdentifier | M2MDCommandIdentifier | HKCommandIdentifier
345
+ | str): Command identifier, internal to the commanded device.
346
+ cargo1 (int): Reference to the first 16-bit cargo word.
347
+ cargo2 (int): Reference to the second 16-bit cargo word.
348
+
349
+ Returns:
350
+ Command string to send to the TCU Arduino.
351
+ """
352
+
353
+ _create_cmd_string.transaction_id += 1
354
+
355
+ # Adopted from Vladimiro's code
356
+
357
+ address = format_value(cmd_address)
358
+ cmd_identifier = format_value(cmd_identifier)
359
+ cargo1 = format_value(cargo1)
360
+ cargo2 = format_value(cargo2)
361
+
362
+ transaction_id = f"0x{_create_cmd_string.transaction_id:X}"[2:].zfill(4)
363
+
364
+ cmd_string = (
365
+ f"{TCU_LOGICAL_ADDRESS}{packet_type.value} {transaction_id} {DATA_LENGTH} "
366
+ f"{address} {cmd_identifier} {cargo1} {cargo2}"
367
+ )
368
+
369
+ cmd_string = append_crc16(cmd_string)
370
+ return cmd_string
371
+
372
+
373
+ def create_crc16(cmd_str: str, ln: int = 14) -> str:
374
+ """Calculates the 16-bit Cyclic Redundancy Check (CRC) checksum for the given command string.
375
+
376
+ The CRC-16 is an error-detecting code that generates a 16-bit checksum to verify data integrity during
377
+ transmission. It works by performing a polynomial division (using XOR operations) on the data, with the remainder
378
+ becoming the CRC checksum. The receiver performs the same division: A zero remainder indicates the data arrived
379
+ uncorrupted, while a non-zero remainder signals a potential error.
380
+
381
+ The leading "0x" is stripped off and the CRC is padded with leading zeros to ensure it is always 4 characters long.
382
+
383
+ Args:
384
+ cmd_str (str): Command string for which the CRC will be calculated.
385
+ ln (int): Number of bytes to include in the CRC calculation.
386
+
387
+ Returns:
388
+ Calculated 16-bit CRC checksum.
389
+ """
390
+
391
+ # Adapted from Vladimiro's code
392
+
393
+ byte_array = bytearray([int(cmd_str[2 * i : 2 * i + 2], 16) for i in range(ln)])
394
+
395
+ crc16_func = crcmod.mkCrcFun(0x11021, 0xFFFF, False, 0x0)
396
+ crc16 = hex(crc16_func(byte_array))
397
+
398
+ crc16 = crc16[2:6].zfill(4) # Crop leading "0x" + ensure 4 characters
399
+
400
+ return crc16
401
+
402
+
403
+ def append_crc16(cmd_string: str, ln: int = 14) -> str:
404
+ """Appends a 16-bit CRC checksum to the given command string.
405
+
406
+ Args:
407
+ cmd_string (str): Command string to which the CRC will be appended.
408
+ ln (int): Number of bytes to include in the CRC calculation.
409
+
410
+ Returns:
411
+ Command string with the appended CRC checksum.
412
+ """
413
+
414
+ crc16 = create_crc16(cmd_string, ln)
415
+
416
+ return f"{cmd_string} {crc16}"
417
+
418
+
419
+ # General commands
420
+
421
+
422
+ def tcu_firmware_id() -> str:
423
+ """Builds the command string for the general TCU_FIRMWARE_ID read command.
424
+
425
+ Returns:
426
+ Command string for the general TCU_FIRMWARE_ID read command.
427
+ """
428
+
429
+ return _create_read_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.TCU_FIRMWARE_ID)
430
+
431
+
432
+ def get_tcu_mode() -> str:
433
+ """Builds the command string for the general TCU_MODE read command.
434
+
435
+ Returns:
436
+ Command string for the general TCU_MODE read command.
437
+ """
438
+
439
+ return _create_read_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.TCU_MODE)
440
+
441
+
442
+ def set_tcu_mode(tcu_mode: TcuMode | int = TcuMode.IDLE):
443
+ """Builds the command string for the general TCU_MODE write command.
444
+
445
+ Args:
446
+ tcu_mode (TcuMode | int): TCU mode.
447
+
448
+ Returns:
449
+ Command string for the general TCU_MODE write command.
450
+ """
451
+
452
+ return _create_write_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.TCU_MODE, cargo2=tcu_mode)
453
+
454
+
455
+ def tcu_status() -> str:
456
+ """Builds the command string for the general TCU_STATUS read command.
457
+
458
+ Returns:
459
+ Command string for the general TCU_STATUS read command.
460
+ """
461
+
462
+ return _create_read_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.TCU_STATUS)
463
+
464
+
465
+ def tcu_simulated(cargo2: int):
466
+ """Builds the command string for the general TCU_SIMULATED write command.
467
+
468
+ Args:
469
+ cargo2 (int): Cargo 2 part of the command string.
470
+
471
+ Returns:
472
+ Command string for the general TCU_SIMULATED write command.
473
+ """
474
+
475
+ return _create_write_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.TCU_SIMULATED, cargo2=cargo2)
476
+
477
+
478
+ def restart_links_period_latch(cargo2: int):
479
+ """Builds the command string for the general RESTART_LINKS_PERIOD_LATCH write command.
480
+
481
+ Args:
482
+ cargo2 (int): Cargo 2 part of the command string.
483
+
484
+ Returns:
485
+ Command string for the general RESTART_LINKS_PERIOD_LATCH write command.
486
+ """
487
+
488
+ return _create_write_cmd_string(
489
+ CommandAddress.GENERAL, GeneralCommandIdentifier.RESTART_LINKS_PERIOD_LATCH, cargo2=cargo2
490
+ )
491
+
492
+
493
+ def get_restart_links_period() -> str:
494
+ """Builds the command string for the general RESTART_LINKS_PERIOD_LATCH read command.
495
+
496
+ Returns:
497
+ Command string for the general RESTART_LINKS_PERIOD_LATCH read command.
498
+ """
499
+
500
+ return _create_read_cmd_string(CommandAddress.GENERAL, GeneralCommandIdentifier.RESTART_LINKS_PERIOD)
501
+
502
+
503
+ def set_restart_links_period(link_period: int = 0xFFFF) -> str:
504
+ """Builds the command string for the general RESTART_LINKS_PERIOD write command.
505
+
506
+ Args:
507
+ link_period (int): Link period.
508
+
509
+ Returns:
510
+ Command string for the general RESTART_LINKS_PERIOD write command.
511
+ """
512
+
513
+ return _create_write_cmd_string(
514
+ CommandAddress.GENERAL,
515
+ GeneralCommandIdentifier.RESTART_LINKS_PERIOD,
516
+ cargo2=link_period,
517
+ )
518
+
519
+
520
+ # M2MD commands
521
+
522
+
523
+ def ope_mng_command(axis: CommandAddress | str | int, cargo2: int = 0x0002) -> str:
524
+ """Builds the command string fort he M2MD OPE_MNG_COMMAND write command.
525
+
526
+ Args:
527
+ axis (CommandAddress | str | int): Axis to which the command is sent.
528
+ cargo2 (int): Cargo 2 part of the command string.
529
+
530
+ Returns:
531
+ Command string for the M2MD OPE_MNG_COMMAND write command.
532
+ """
533
+
534
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.OPE_MNG_COMMAND, cargo2=cargo2)
535
+
536
+
537
+ def ope_mng_event_clear_protect_flag(axis: CommandAddress | str | int, cargo2: str | int = 0xAAAA) -> str:
538
+ """Builds the command string for the M2MD OPE_MNG_EVENT_CLEAR_PROTECT_FLAG write command.
539
+
540
+ Args:
541
+ axis (CommandAddress | str | int): Axis to which the command is sent.
542
+ cargo2 (int): Cargo 2 part of the command string.
543
+
544
+ Returns:
545
+ Command string for the M2MD OPE_MNG_EVENT_CLEAR_PROTECT_FLAG write command.
546
+ """
547
+
548
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.OPE_MNG_EVENT_CLEAR_PROTECT_FLAG, cargo2=cargo2)
549
+
550
+
551
+ def ope_mng_event_clear(axis: CommandAddress | str | int, cargo2: int = 0) -> str:
552
+ """Builds the command string for the M2MD OPE_MNG_EVENT_CLEAR write command.
553
+
554
+ Args:
555
+ axis (CommandAddress | str | int): Axis to which the command is sent.
556
+ cargo2 (int): Cargo 2 part of the command string.
557
+
558
+ Returns:
559
+ Command string for the M2MD OPE_MNG_EVENT_CLEAR write command.
560
+ """
561
+
562
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.OPE_MNG_EVENT_CLEAR, cargo2=cargo2)
563
+
564
+
565
+ def ope_mng_status(axis: CommandAddress | str | int) -> str:
566
+ """Builds the command string for the M2MD OPE_MNG_STATUS read command.
567
+
568
+ Args:
569
+ axis (CommandAddress | str | int): Axis to which the command is sent.
570
+
571
+ Returns:
572
+ Command string for the M2MD OPE_MNG_STATUS read command.
573
+ """
574
+
575
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.OPE_MNG_STATUS)
576
+
577
+
578
+ def ope_mng_event_reg(axis: CommandAddress | str | int) -> str:
579
+ """Builds the command string for the M2MD OPE_MNG_EVENT_REG read command.
580
+
581
+ Args:
582
+ axis (CommandAddress | str | int): Axis to which the command is sent.
583
+
584
+ Returns:
585
+ Command string for the M2MD OPE_MNG_EVENT_REG read command.
586
+ """
587
+
588
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.OPE_MNG_EVENT_REG)
589
+
590
+
591
+ def get_acq_curr_off_corr(axis: CommandAddress | str | int) -> str:
592
+ """Builds the command string for the M2MD ACQ_CURR_OFF_CORR read command.
593
+
594
+ Args:
595
+ axis (CommandAddress | str | int): Axis to which the command is sent.
596
+
597
+ Returns:
598
+ Command string for the M2MD ACQ_CURR_OFF_CORR read command.
599
+ """
600
+
601
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.ACQ_CURR_OFF_CORR)
602
+
603
+
604
+ def set_acq_curr_off_corr(axis: CommandAddress | str | int, cargo2: int = 0x03FB) -> str:
605
+ """Builds the command string for the M2MD ACQ_CURR_OFF_CORR write command.
606
+
607
+ Args:
608
+ axis (CommandAddress | str | int): Axis to which the command is sent.
609
+ cargo2 (int): Cargo 2 part of the command string.
610
+
611
+ Returns:
612
+ Command string for the M2MD ACQ_CURR_OFF_CORR write command.
613
+ """
614
+
615
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_CURR_OFF_CORR, cargo2=cargo2)
616
+
617
+
618
+ def get_acq_curr_gain_corr(axis: CommandAddress | str | int) -> str:
619
+ """Builds the command string for the M2MD ACQ_CURR_GAIN_CORR read command.
620
+
621
+ Args:
622
+ axis (CommandAddress | str | int): Axis to which the command is sent.
623
+
624
+ Returns:
625
+ Command string for the M2MD ACQ_CURR_GAIN_CORR read command.
626
+ """
627
+
628
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.ACQ_CURR_GAIN_CORR)
629
+
630
+
631
+ def set_acq_curr_gain_corr(axis: CommandAddress | str | int, cargo2: int = 0x074C):
632
+ """Builds the command string for the M2MD ACQ_CURR_GAIN_CORR write command.
633
+
634
+ Args:
635
+ axis (CommandAddress | str | int): Axis to which the command is sent.
636
+ cargo2 (int): Cargo 2 part of the command string.
637
+
638
+ Returns:
639
+ Command string for the M2MD ACQ_CURR_GAIN_CORR write command.
640
+ """
641
+
642
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_CURR_GAIN_CORR, cargo2=cargo2)
643
+
644
+
645
+ def acq_axis_a_curr_read(axis: CommandAddress | str | int) -> str:
646
+ """Builds the command string for the M2MD ACQ_AXIS_A_CURR_READ read command.
647
+
648
+ Args:
649
+ axis (CommandAddress | str | int): Axis to which the command is sent.
650
+
651
+ Returns:
652
+ Command string for the M2MD ACQ_AXIS_A_CURR_READ read command.
653
+ """
654
+
655
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.ACQ_AXIS_A_CURR_READ)
656
+
657
+
658
+ def acq_axis_b_curr_read(axis: CommandAddress | str | int) -> str:
659
+ """Builds the command string for the M2MD ACQ_AXIS_B_CURR_READ read command.
660
+
661
+ Args:
662
+ axis (CommandAddress | str | int): Axis to which the command is sent.
663
+
664
+ Returns:
665
+ Command string for the M2MD ACQ_AXIS_B_CURR_READ read command.
666
+ """
667
+
668
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.ACQ_AXIS_B_CURR_READ)
669
+
670
+
671
+ def acq_ave_lpf_en(axis: CommandAddress | str | int, cargo2: int = 0) -> str:
672
+ """Builds the command string for the M2MD ACQ_AVE_LPF_EN write command.
673
+
674
+ Args:
675
+ axis (CommandAddress | str | int): Axis to which the command is sent.
676
+ cargo2 (int): Cargo 2 part of the command string.
677
+
678
+ Returns:
679
+ Command string for the M2MD ACQ_AVE_LPF_EN write command.
680
+ """
681
+
682
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_AVE_LPF_EN, cargo2=cargo2)
683
+
684
+
685
+ def acq_ovc_cfg_filter(axis: CommandAddress | str | int, cargo2: int = 0) -> str:
686
+ """Builds the command string for the M2MD ACQ_OVC_CFG_FILTER write command.
687
+
688
+ Args:
689
+ axis (CommandAddress | str | int): Axis to which the command is sent.
690
+ cargo2 (int): Cargo 2 part of the command string.
691
+
692
+ Returns:
693
+ Command string for the M2MD ACQ_OVC_CFG_FILTER write command.
694
+ """
695
+
696
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_OVC_CFG_FILTER, cargo2=cargo2)
697
+
698
+
699
+ def acq_avc_filt_time(axis: CommandAddress | str | int, cargo2: int = 0) -> str:
700
+ """Builds the command string for the M2MD ACQ_AVC_FILT_TIME write command.
701
+
702
+ Args:
703
+ axis (CommandAddress | str | int): Axis to which the command is sent.
704
+ cargo2 (int): Cargo 2 part of the command string.
705
+
706
+ Returns:
707
+ Command string for the M2MD ACQ_AVC_FILT_TIME write command.
708
+ """
709
+
710
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_AVC_FILT_TIME, cargo2=cargo2)
711
+
712
+
713
+ def acq_average_type(axis: CommandAddress | str | int, cargo2: int = 0x0000) -> str:
714
+ """Builds the command string for the M2MD ACQ_AVERAGE_TYPE write command.
715
+
716
+ Args:
717
+ axis (CommandAddress | str | int): Axis to which the command is sent.
718
+ cargo2 (int): Cargo 2 part of the command string.
719
+
720
+ Returns:
721
+ Command string for the M2MD ACQ_AVERAGE_TYPE write command.
722
+ """
723
+
724
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_AVERAGE_TYPE, cargo2=cargo2)
725
+
726
+
727
+ def acq_spk_filt_counter_lim(axis: CommandAddress | str | int, cargo2: int = 0x0001) -> str:
728
+ """Builds the command string for the M2MD ACQ_SPK_FILT_COUNTER_LIM write command.
729
+
730
+ Args:
731
+ axis (CommandAddress | str | int): Axis to which the command is sent.
732
+ cargo2 (int): Cargo 2 part of the command string.
733
+
734
+ Returns:
735
+ Command string for the M2MD ACQ_SPK_FILT_COUNTER_LIM write command.
736
+ """
737
+
738
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_SPK_FILT_COUNTER_LIM, cargo2=cargo2)
739
+
740
+
741
+ def acq_spk_filt_incr_thr(axis: CommandAddress | str | int, cargo2: int = 0x04C0) -> str:
742
+ """Builds the command string for the M2MD ACQ_SPK_FILT_INCR_THR write command.
743
+
744
+ Args:
745
+ axis (CommandAddress | str | int): Axis to which the command is sent.
746
+ cargo2 (int): Cargo 2 part of the command string.
747
+
748
+ Returns:
749
+ Command string for the M2MD ACQ_SPK_FILT_INCR_THR write command.
750
+ """
751
+
752
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.ACQ_SPK_FILT_INCR_THR, cargo2=cargo2)
753
+
754
+
755
+ def get_prof_gen_axis_step(axis: CommandAddress | str | int) -> str:
756
+ """Builds the command string for the M2MD PROF_GEN_AXIS_STEP read command.
757
+
758
+ Args:
759
+ axis (CommandAddress | str | int): Axis to which the command is sent.
760
+
761
+ Returns:
762
+ Command string for the M2MD PROF_GEN_AXIS_STEP read command.
763
+ """
764
+
765
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_STEP)
766
+
767
+
768
+ def set_prof_gen_axis_step(axis: CommandAddress | str | int, cargo2: int = 0x0480) -> str:
769
+ """Builds the command string for the M2MD PROF_GEN_AXIS_STEP write command.
770
+
771
+ Args:
772
+ axis (CommandAddress | str | int): Axis to which the command is sent.
773
+ cargo2 (int): Cargo 2 part of the command string.
774
+
775
+ Returns:
776
+ Command string for the M2MD PROF_GEN_AXIS_STEP write command.
777
+ """
778
+
779
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_STEP, cargo2=cargo2)
780
+
781
+
782
+ def get_prof_gen_axis_speed(axis: CommandAddress | str | int) -> str:
783
+ """Builds the command string for the M2MD PROF_GEN_AXIS_SPEED read command.
784
+
785
+ Args:
786
+ axis (CommandAddress | str | int): Axis to which the command is sent.
787
+
788
+ Returns:
789
+ Command string for the M2MD PROF_GEN_AXIS_SPEED read command.
790
+ """
791
+
792
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_SPEED)
793
+
794
+
795
+ def set_prof_gen_axis_speed(axis: CommandAddress | str | int, cargo2: int = 0x1777) -> str:
796
+ """Builds the command string for the M2MD PROF_GEN_AXIS_SPEED write command.
797
+
798
+ Args:
799
+ axis (CommandAddress | str | int): Axis to which the command is sent.
800
+ cargo2 (int): Cargo 2 part of the command string.
801
+
802
+ Returns:
803
+ Command string for the M2MD PROF_GEN_AXIS_SPEED write command.
804
+ """
805
+
806
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_SPEED, cargo2=cargo2)
807
+
808
+
809
+ def get_prof_gen_axis_state_start(axis: CommandAddress | str | int) -> str:
810
+ """Builds the command string for the M2MD PROF_GEN_AXIS_STATE_START read command.
811
+
812
+ Args:
813
+ axis (CommandAddress | str | int): Axis to which the command is sent.
814
+
815
+ Returns:
816
+ Command string for the M2MD PROF_GEN_AXIS_STATE_START read command.
817
+ """
818
+
819
+ return _create_read_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_STATE_START)
820
+
821
+
822
+ def set_prof_gen_axis_state_start(axis: CommandAddress | str | int, cargo2: int = 0) -> str:
823
+ """Builds the command string for the M2MD PROF_GEN_AXIS_STATE_START write command.
824
+
825
+ Args:
826
+ axis (CommandAddress | str | int): Axis to which the command is sent.
827
+ cargo2 (int): Cargo 2 part of the command string.
828
+
829
+ Returns:
830
+ Command string for the M2MD PROF_GEN_AXIS_STATE_START write command.
831
+ """
832
+
833
+ return _create_write_cmd_string(axis, M2MDCommandIdentifier.PROF_GEN_AXIS_STATE_START, cargo2=cargo2)
834
+
835
+
836
+ def sw_rs_xx_sw_rise(axis: CommandAddress | str | int, position: int = 1) -> str:
837
+ """Builds the command string for the M2MD SW_RS_XX_SW_RISE read command.
838
+
839
+ Args:
840
+ axis (CommandAddress | str | int): Axis to which the command is sent.
841
+ position (int): Position of the SW_RS_XX_SW_RISE command.
842
+
843
+ Returns:
844
+ Command string for the M2MD SW_RS_XX_SW_RISE read command.
845
+ """
846
+
847
+ # Adopted from Vladimiro's code
848
+ m2md_cmd_id = get_sw_rs_xx_sw_cmd_id(M2MDCommandIdentifier.SW_RS_XX_SW_RISE, position)
849
+
850
+ return _create_read_cmd_string(axis, cmd_identifier=m2md_cmd_id)
851
+
852
+
853
+ def sw_rs_xx_sw_fall(axis: CommandAddress | str | int, position: int = 1) -> str:
854
+ """Builds the command string for the M2MD SW_RS_XX_SW_FALL read command.
855
+
856
+ Args:
857
+ axis (CommandAddress | str | int): Axis to which the command is sent.
858
+ position (int): Position of the SW_RS_XX_SW_FALL command.
859
+
860
+ Returns:
861
+ Command string for the M2MD SW_RS_XX_SW_FALL read command.
862
+ """
863
+
864
+ # Adopted from Vladimiro's code
865
+ offset_position = position + 21
866
+ m2md_cmd_id = get_sw_rs_xx_sw_cmd_id(M2MDCommandIdentifier.SW_RS_XX_SW_FALL, offset_position)
867
+
868
+ return _create_read_cmd_string(axis, cmd_identifier=m2md_cmd_id)
869
+
870
+
871
+ # TSM commands
872
+
873
+
874
+ def tsm_latch(cargo1: int = 0, cargo2: int = 0) -> str:
875
+ """Builds the command string for the TSM TSM_LATCH write command.
876
+
877
+ Args:
878
+ cargo1 (int): Cargo 1 part of the command string.
879
+ cargo2 (int): Cargo 2 part of the command string.
880
+
881
+ Returns:
882
+ Command string for the TSM TSM_LATCH write command.
883
+ """
884
+
885
+ return _create_write_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_LATCH, cargo1=cargo1, cargo2=cargo2)
886
+
887
+
888
+ def get_tsm_current_value() -> str:
889
+ """Builds the command string for the TSM TSM_CURRENT_VALUE read command.
890
+
891
+ Returns:
892
+ Command string for the TSM TSM_CURRENT_VALUE read command.
893
+ """
894
+
895
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_CURRENT_VALUE)
896
+
897
+
898
+ def set_tsm_current_value(cargo1: int = 0, cargo2: int = 0) -> str:
899
+ """Builds the command string for the TSM TSM_CURRENT_VALUE write command.
900
+
901
+ Args:
902
+ cargo1 (int): Cargo 1 part of the command string.
903
+ cargo2 (int): Cargo 2 part of the command string.
904
+
905
+ Returns:
906
+ Command string for the TSM TSM_CURRENT_VALUE write command.
907
+ """
908
+
909
+ return _create_write_cmd_string(
910
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_CURRENT_VALUE, cargo1=cargo1, cargo2=cargo2
911
+ )
912
+
913
+
914
+ def get_tsm_current_offset() -> str:
915
+ """Builds the command string for the TSM TSM_CURRENT_OFFSET read command.
916
+
917
+ Returns:
918
+ Command string for the TSM TSM_CURRENT_OFFSET read command.
919
+ """
920
+
921
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_CURRENT_OFFSET)
922
+
923
+
924
+ def set_tsm_current_offset(cargo1: int = 0, cargo2: int = 0) -> str:
925
+ """Builds the command string for the TSM TSM_CURRENT_OFFSET write command.
926
+
927
+ Args:
928
+ cargo1 (int): Cargo 1 part of the command string.
929
+ cargo2 (int): Cargo 2 part of the command string.
930
+
931
+ Returns:
932
+ Command string for the TSM TSM_CURRENT_OFFSET write command.
933
+ """
934
+
935
+ return _create_write_cmd_string(
936
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_CURRENT_OFFSET, cargo1=cargo1, cargo2=cargo2
937
+ )
938
+
939
+
940
+ def tsm_adc_register_latch(cargo1: int = 0, cargo2: int = 0) -> str:
941
+ """Builds the command string for the TSM TSM_ADC_REGISTER_LATCH write command.
942
+
943
+ Args:
944
+ cargo1 (int): Cargo 1 part of the command string.
945
+ cargo2 (int): Cargo 2 part of the command string.
946
+
947
+ Returns:
948
+ Command string for the TSM TSM_ADC_REGISTER_LATCH write command.
949
+ """
950
+
951
+ return _create_write_cmd_string(
952
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_REGISTER_LATCH, cargo1=cargo1, cargo2=cargo2
953
+ )
954
+
955
+
956
+ def tsm_adc_id_register() -> str:
957
+ """Builds the command string for the TSM TSM_ADC_ID_REGISTER read command.
958
+
959
+ Returns:
960
+ Command string for the TSM TSM_ADC_ID_REGISTER read command.
961
+ """
962
+
963
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_ID_REGISTER)
964
+
965
+
966
+ def tsm_adc_configuration_register() -> str:
967
+ """Builds the command string for the TSM TSM_ADC_CONFIGURATION_REGISTER read command.
968
+
969
+ Returns:
970
+ Command string for the TSM TSM_ADC_CONFIGURATION_REGISTER read command.
971
+ """
972
+
973
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_CONFIGURATION_REGISTER)
974
+
975
+
976
+ def get_tsm_adc_hpf_register() -> str:
977
+ """Builds the command string for the TSM TSM_ADC_HPF_REGISTER read command.
978
+
979
+ Returns:
980
+ Command string for the TSM TSM_ADC_HPF_REGISTER read command.
981
+ """
982
+
983
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_HPF_REGISTER)
984
+
985
+
986
+ def set_tsm_adc_hpf_register(cargo1: int = 0, cargo2: int = 0) -> str:
987
+ """Builds the command string for the TSM TSM_ADC_HPF_REGISTER write command.
988
+
989
+ Args:
990
+ cargo1 (int): Cargo 1 part of the command string.
991
+ cargo2 (int): Cargo 2 part of the command string.
992
+
993
+ Returns:
994
+ Command string for the TSM TSM_ADC_HPF_REGISTER write command.
995
+ """
996
+
997
+ return _create_write_cmd_string(
998
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_HPF_REGISTER, cargo1=cargo1, cargo2=cargo2
999
+ )
1000
+
1001
+
1002
+ def get_tsm_adc_ofc_register() -> str:
1003
+ """Builds the command string for the TSM TSM_ADC_OFC_REGISTER read command.
1004
+
1005
+ Returns:
1006
+ Command string for the TSM TSM_ADC_OFC_REGISTER read command.
1007
+ """
1008
+
1009
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_OFC_REGISTER)
1010
+
1011
+
1012
+ def set_tsm_adc_ofc_register(cargo1: int = 0, cargo2: int = 0) -> str:
1013
+ """Builds the command string for the TSM TSM_ADC_OFC_REGISTER write command.
1014
+
1015
+ Args:
1016
+ cargo1 (int): Cargo 1 part of the command string.
1017
+ cargo2 (int): Cargo 2 part of the command string.
1018
+
1019
+ Returns:
1020
+ Command string for the TSM TSM_ADC_OFC_REGISTER write command.
1021
+ """
1022
+
1023
+ return _create_write_cmd_string(
1024
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_OFC_REGISTER, cargo1=cargo1, cargo2=cargo2
1025
+ )
1026
+
1027
+
1028
+ def get_tsm_adc_fsc_register() -> str:
1029
+ """Builds the command string for the TSM TSM_ADC_FSC_REGISTER read command.
1030
+
1031
+ Returns:
1032
+ Command string for the TSM TSM_ADC_FSC_REGISTER read command.
1033
+ """
1034
+
1035
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_FSC_REGISTER)
1036
+
1037
+
1038
+ def set_tsm_adc_fsc_register(cargo1: int = 0, cargo2: int = 0) -> str:
1039
+ """Builds the command string for the TSM TSM_ADC_FSC_REGISTER write command.
1040
+
1041
+ Args:
1042
+ cargo1 (int): Cargo 1 part of the command string.
1043
+ cargo2 (int): Cargo 2 part of the command string.
1044
+
1045
+ Returns:
1046
+ Command string for the TSM TSM_ADC_FSC_REGISTER write command.
1047
+ """
1048
+
1049
+ return _create_write_cmd_string(
1050
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_FSC_REGISTER, cargo1=cargo1, cargo2=cargo2
1051
+ )
1052
+
1053
+
1054
+ def tsm_adc_command_latch(cargo1: int = 0, cargo2: int = 0) -> str:
1055
+ """Builds the command string for the TSM TSM_ADC_COMMAND_LATCH write command.
1056
+
1057
+ Args:
1058
+ cargo1 (int): Cargo 1 part of the command string.
1059
+ cargo2 (int): Cargo 2 part of the command string.
1060
+
1061
+ Returns:
1062
+ Command string for the TSM TSM_ADC_COMMAND_LATCH write command.
1063
+ """
1064
+
1065
+ return _create_write_cmd_string(
1066
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_COMMAND_LATCH, cargo1=cargo1, cargo2=cargo2
1067
+ )
1068
+
1069
+
1070
+ def tsm_adc_command(cargo1: int = 0, cargo2: int = 0) -> str:
1071
+ """Builds the command string for the TSM TSM_ADC_COMMAND write command.
1072
+
1073
+ Args:
1074
+ cargo1 (int): Cargo 1 part of the command string.
1075
+ cargo2 (int): Cargo 2 part of the command string.
1076
+
1077
+ Returns:
1078
+ Command string for the TSM TSM_ADC_COMMAND write command.
1079
+ """
1080
+
1081
+ return _create_write_cmd_string(
1082
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_COMMAND, cargo1=cargo1, cargo2=cargo2
1083
+ )
1084
+
1085
+
1086
+ def tsm_adc_calibration(cargo1: int = 0, cargo2: int = 0) -> str:
1087
+ """Builds the command string for the TSM TSM_ADC_CALIBRATION write command.
1088
+
1089
+ Args:
1090
+ cargo1 (int): Cargo 1 part of the command string.
1091
+ cargo2 (int): Cargo 2 part of the command string.
1092
+
1093
+ Returns:
1094
+ Command string for the TSM TSM_ADC_CALIBRATION write command.
1095
+ """
1096
+
1097
+ return _create_write_cmd_string(
1098
+ CommandAddress.TSM, TSMCommandIdentifier.TSM_ADC_CALIBRATION, cargo1=cargo1, cargo2=cargo2
1099
+ )
1100
+
1101
+
1102
+ def tsm_adc_value_xx_currentn(probe: int = 1) -> str:
1103
+ """Builds the command string for the TSM TSM_ADC_VALUE_XX_CURRENTN read command.
1104
+
1105
+ Args:
1106
+ probe (int): Thermistor identifier.
1107
+
1108
+ Returns:
1109
+ Command string for the TSM TSM_ADC_VALUE_XX_CURRENTN read command.
1110
+ """
1111
+
1112
+ tsm_cmd_id = get_tsm_adc_value_xx_currentn_cmd_id(probe)
1113
+
1114
+ return _create_read_cmd_string(CommandAddress.TSM, tsm_cmd_id)
1115
+
1116
+
1117
+ def tsm_adc_value_xx_biasn(probe: int = 1):
1118
+ """Builds the command string for the TSM TSM_ADC_VALUE_XX_BIASN read command.
1119
+
1120
+ Args:
1121
+ probe (int): Thermistor identifier.
1122
+
1123
+ Returns:
1124
+ Command string for the TSM TSM_ADC_VALUE_XX_BIASN read command.
1125
+ """
1126
+
1127
+ tsm_cmd_id = get_tsm_adc_value_xx_biasn_cmd_id(probe)
1128
+
1129
+ return _create_read_cmd_string(CommandAddress.TSM, tsm_cmd_id)
1130
+
1131
+
1132
+ def tsm_adc_value_xx_currentp(probe: int = 1) -> str:
1133
+ """Builds the command string for the TSM TSM_ADC_VALUE_XX_CURRENTP read command.
1134
+
1135
+ Args:
1136
+ probe (int): Thermistor identifier.
1137
+
1138
+ Returns:
1139
+ Command string for the TSM TSM_ADC_VALUE_XX_CURRENTP read command.
1140
+ """
1141
+
1142
+ tsm_cmd_id = get_tsm_adc_value_xx_currentp_cmd_id(probe)
1143
+
1144
+ return _create_read_cmd_string(CommandAddress.TSM, tsm_cmd_id)
1145
+
1146
+
1147
+ def tsm_adc_value_xx_biasp(probe: int = 1) -> str:
1148
+ """Builds the command string for the TSM TSM_ADC_VALUE_XX_BIASP read command.
1149
+
1150
+ Args:
1151
+ probe (int): Thermistor identifier.
1152
+
1153
+ Returns:
1154
+ Command string for the TSM TSM_ADC_VALUE_XX_BIASP read command.
1155
+ """
1156
+
1157
+ tsm_cmd_id = get_tsm_adc_value_xx_biasp_cmd_id(probe)
1158
+
1159
+ return _create_read_cmd_string(CommandAddress.TSM, tsm_cmd_id)
1160
+
1161
+
1162
+ def tsm_acq_counter() -> str:
1163
+ """Builds the command string for the TSM TSM_ACQ_COUNTER read command.
1164
+
1165
+ Returns:
1166
+ Command string for the TSM TSM_ACQ_COUNTER read command.
1167
+ """
1168
+
1169
+ return _create_read_cmd_string(CommandAddress.TSM, TSMCommandIdentifier.TSM_ACQ_COUNTER)
1170
+
1171
+
1172
+ def vhk_psu_vmotor() -> str:
1173
+ """Builds the command string for the HK VHK_PSU_VMOTOR read command.
1174
+
1175
+ Returns:
1176
+ Command string for the HK PSU VHK_PSU_VMOTOR read command.
1177
+ """
1178
+
1179
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_PSU_VMOTOR)
1180
+
1181
+
1182
+ def vhk_psu_vhi() -> str:
1183
+ """Builds the command string for the HK VHK_PSU_VHI read command.
1184
+
1185
+ Returns:
1186
+ Command string for the HK PSU VHK_PSU_VHI read command.
1187
+ """
1188
+
1189
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_PSU_VHI)
1190
+
1191
+
1192
+ def vhk_psu_vlow() -> str:
1193
+ """Builds the command string for the HK VHK_PSU_VLW read command.
1194
+
1195
+ Returns:
1196
+ Command string for the HK PSU VHK_PSU_VLOW read command.
1197
+ """
1198
+
1199
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_PSU_VLOW)
1200
+
1201
+
1202
+ def vhk_psu_vmedp() -> str:
1203
+ """Builds the command string for the HK VHK_PSU_VMEDP read command.
1204
+
1205
+ Returns:
1206
+ Command string for the HK PSU VHK_PSU_VMEDP read command.
1207
+ """
1208
+
1209
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_PSU_VMEDP)
1210
+
1211
+
1212
+ def vhk_psu_vmedn() -> str:
1213
+ """Builds the command string for the HK VHK_PSU_VMEDN read command.
1214
+
1215
+ Returns:
1216
+ Command string for the HK PSU VHK_PSU_VMEDN read command.
1217
+ """
1218
+
1219
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_PSU_VMEDN)
1220
+
1221
+
1222
+ def ihk_psu_vmedn() -> str:
1223
+ """Builds the command string for the HK IHK_PSU_VMEDN read command.
1224
+
1225
+ Returns:
1226
+ Command string for the HK PSU IHK_PSU_VMEDN read command.
1227
+ """
1228
+
1229
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.IHK_PSU_VMEDN)
1230
+
1231
+
1232
+ def ihk_psu_vmedp() -> str:
1233
+ """Builds the command string for the HK IHK_PSU_VMEDP read command.
1234
+
1235
+ Returns:
1236
+ Command string for the HK PSU IHK_PSU_VMEDP read command.
1237
+ """
1238
+
1239
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.IHK_PSU_VMEDP)
1240
+
1241
+
1242
+ def ihk_psu_vlow() -> str:
1243
+ """Builds the command string for the HK IHK_PSU_VLOW read command.
1244
+
1245
+ Returns:
1246
+ Command string for the HK PSU IHK_PSU_VLOW read command.
1247
+ """
1248
+
1249
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.IHK_PSU_VLOW)
1250
+
1251
+
1252
+ def ihk_psu_vhi():
1253
+ """Builds the command string for the HK IHK_PSU_VHI read command.
1254
+
1255
+ Returns:
1256
+ Command string for the HK PSU IHK_PSU_VHI read command.
1257
+ """
1258
+
1259
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.IHK_PSU_VHI)
1260
+
1261
+
1262
+ def ihk_psu_vmotor() -> str:
1263
+ """Builds the command string for the HK IHK_PSU_VMOTOR read command.
1264
+
1265
+ Returns:
1266
+ Command string for the HK PSU IHK_PSU_VMOTOR read command.
1267
+ """
1268
+
1269
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.IHK_PSU_VMOTOR)
1270
+
1271
+
1272
+ def thk_psu_first() -> str:
1273
+ """Builds the command string for the HK THK_PSU_FIRST read command.
1274
+
1275
+ Returns:
1276
+ Command string for the HK PSU THK_PSU_FIRST read command.
1277
+ """
1278
+
1279
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_PSU_FIRST)
1280
+
1281
+
1282
+ def thk_m2md_first() -> str:
1283
+ """Builds the command string for the HK THK_M2MD_FIRST read command.
1284
+
1285
+ Returns:
1286
+ Command string for the HK M2MD THK_M2MD_FIRST read command.
1287
+ """
1288
+
1289
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_M2MD_FIRST)
1290
+
1291
+
1292
+ def thk_psu_second() -> str:
1293
+ """Builds the command string for the HK THK_PSU_SECOND read command.
1294
+
1295
+ Returns:
1296
+ Command string for the HK PSU THK_PSU_SECOND read command.
1297
+ """
1298
+
1299
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_PSU_SECOND)
1300
+
1301
+
1302
+ def thk_m2md_second() -> str:
1303
+ """Builds the command string for the HK THK_M2MD_SECOND read command.
1304
+
1305
+ Returns:
1306
+ Command string for the HK M2MD THK_M2MD_SECOND read command.
1307
+ """
1308
+
1309
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_M2MD_SECOND)
1310
+
1311
+
1312
+ def thk_cts_q1() -> str:
1313
+ """Builds the command string for the HK THK_CTS_Q1 read command.
1314
+
1315
+ Returns:
1316
+ Command string for the HK CTS THK_CTS_Q1 read command.
1317
+ """
1318
+
1319
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_Q1)
1320
+
1321
+
1322
+ def thk_cts_q2() -> str:
1323
+ """Builds the command string for the HK THK_CTS_Q2 read command.
1324
+
1325
+ Returns:
1326
+ Command string for the HK CTS THK_CTS_Q2 read command.
1327
+ """
1328
+
1329
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_Q2)
1330
+
1331
+
1332
+ def thk_cts_q3() -> str:
1333
+ """Builds the command string for the HK THK_CTS_Q3 read command.
1334
+
1335
+ Returns:
1336
+ Command string for the HK CTS THK_CTS_Q3 read command.
1337
+ """
1338
+
1339
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_Q3)
1340
+
1341
+
1342
+ def thk_cts_q4() -> str:
1343
+ """Builds the command string for the HK THK_CTS_Q4 read command.
1344
+
1345
+ Returns:
1346
+ Command string for the HK CTS THK_CTS_Q4 read command.
1347
+ """
1348
+
1349
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_Q4)
1350
+
1351
+
1352
+ def thk_cts_fpga() -> str:
1353
+ """Builds the command string for the HK THK_CTS_FPGA read command.
1354
+
1355
+ Returns:
1356
+ Command string for the HK CTS THK_CTS_FPGA read command.
1357
+ """
1358
+
1359
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_FPGA)
1360
+
1361
+
1362
+ def thk_cts_ads1282() -> str:
1363
+ """Builds the command string for the HK THK_CTS_ADS1282 read command.
1364
+
1365
+ Returns:
1366
+ Command string for the HK CTS THK_CTS_ADS1282 read command.
1367
+ """
1368
+
1369
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.THK_CTS_ADS1282)
1370
+
1371
+
1372
+ def vhk_ths_ret() -> str:
1373
+ """Builds the command string for the HK VHK_THS_RET read command.
1374
+
1375
+ Returns:
1376
+ Command string for the HK VHK_THS_RET read command.
1377
+ """
1378
+
1379
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.VHK_THS_RET)
1380
+
1381
+
1382
+ def hk_acq_counter() -> str:
1383
+ """Builds the command string for the HK HK_ACQ_COUNTER read command.
1384
+
1385
+ Returns:
1386
+ Command string for the HK HK_ACQ_COUNTER read command.
1387
+ """
1388
+
1389
+ return _create_read_cmd_string(CommandAddress.HK, HKCommandIdentifier.HK_ACQ_COUNTER)