Skip to content

API reference

ctsgen3.registers.registers

TEMP_SENSOR_0x00

Measurement of temperature sensor on CTS PCB close to CMOS Image Sensor (CIS). Dynamically updated every frame.

The temperature is an <8,8> fixed point number.

Source code in src/ctsgen3/registers/registers.py
15
16
17
18
19
20
21
22
23
24
25
26
27
class TEMP_SENSOR_0x00(ctypes.LittleEndianStructure):
    """
    Measurement of temperature sensor on CTS PCB close to CMOS Image Sensor (CIS). Dynamically updated every frame.

    The temperature is an <8,8> fixed point number.
    """

    _fields_ = [
        ("temperature_sensor_0", ctypes.c_int16),
        ("_unimplemented", ctypes.c_int16),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

RESERVED_0x04

Unimplemented.

Source code in src/ctsgen3/registers/registers.py
33
34
35
36
37
38
39
40
class RESERVED_0x04(ctypes.LittleEndianStructure):
    """
    Unimplemented.
    """

    _fields_ = [("_reserved0", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.RESERVED

GLOBAL_FRM_CNT_0x08

Number of thermal frames captured since reset.

Source code in src/ctsgen3/registers/registers.py
46
47
48
49
50
51
52
53
class GLOBAL_FRM_CNT_0x08(ctypes.LittleEndianStructure):
    """
    Number of thermal frames captured since reset.
    """

    _fields_ = [("frame_count", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

RESERVED_0x0C_0x10

Reserved.

Source code in src/ctsgen3/registers/registers.py
59
60
61
62
63
64
65
66
class RESERVED_0x0C_0x10(ctypes.LittleEndianStructure):
    """
    Reserved.
    """

    _fields_ = [("_reserved0", ctypes.c_uint32), ("_reserved1", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.RESERVED

EXPOSURE_0x14

CIS exposure.

Source code in src/ctsgen3/registers/registers.py
72
73
74
75
76
77
78
79
class EXPOSURE_0x14(ctypes.LittleEndianStructure):
    """
    CIS exposure.
    """

    _fields_ = [("exposure", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

LUMINOSITY_0x18

Accumulated luminosity dynamically updated every frame.

Source code in src/ctsgen3/registers/registers.py
85
86
87
88
89
90
91
92
class LUMINOSITY_0x18(ctypes.LittleEndianStructure):
    """
    Accumulated luminosity dynamically updated every frame.
    """

    _fields_ = [("luminosity", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

IS_TEMP_0x1C

Averaged CIS measured temperature.

Source code in src/ctsgen3/registers/registers.py
 98
 99
100
101
102
103
104
105
class IS_TEMP_0x1C(ctypes.LittleEndianStructure):
    """
    Averaged CIS measured temperature.
    """

    _fields_ = [("image_sensor_temp", ctypes.c_int32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

LINEAR_COMP_INST_0x20

Linear compensation for current frame.

Source code in src/ctsgen3/registers/registers.py
111
112
113
114
115
116
117
118
class LINEAR_COMP_INST_0x20(ctypes.LittleEndianStructure):
    """
    Linear compensation for current frame.
    """

    _fields_ = [("linear_comp_inst", ctypes.c_int32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

LINEAR_COMP_AVG_0x24

Moving average for linear compensation (16 frames).

Source code in src/ctsgen3/registers/registers.py
124
125
126
127
128
129
130
131
class LINEAR_COMP_AVG_0x24(ctypes.LittleEndianStructure):
    """
    Moving average for linear compensation (16 frames).
    """

    _fields_ = [("linear_comp_avg", ctypes.c_int32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

SHIELDED_COMP_INST_0x28

Shielded compensation for current frame.

Source code in src/ctsgen3/registers/registers.py
137
138
139
140
141
142
143
144
class SHIELDED_COMP_INST_0x28(ctypes.LittleEndianStructure):
    """
    Shielded compensation for current frame.
    """

    _fields_ = [("shielded_comp_inst", ctypes.c_int32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

SHIELDED_COMP_AVG_0x2C

Moving average for shielded pixel compensation (16 frames).

Source code in src/ctsgen3/registers/registers.py
150
151
152
153
154
155
156
157
class SHIELDED_COMP_AVG_0x2C(ctypes.LittleEndianStructure):
    """
    Moving average for shielded pixel compensation (16 frames).
    """

    _fields_ = [("shielded_comp_avg", ctypes.c_int32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

RESERVED_0x30_0x4C

Unimplemented.

Source code in src/ctsgen3/registers/registers.py
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
class RESERVED_0x30_0x4C(ctypes.LittleEndianStructure):
    """
    Unimplemented.
    """

    _fields_ = [
        ("_reserved0", ctypes.c_uint32),
        ("_reserved1", ctypes.c_uint32),
        ("_reserved2", ctypes.c_uint32),
        ("_reserved3", ctypes.c_uint32),
        ("_reserved4", ctypes.c_uint32),
        ("_reserved5", ctypes.c_uint32),
        ("_reserved6", ctypes.c_uint32),
        ("_reserved7", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.RESERVED

SERIAL_NUMBER_LO_0x50

Upper 32bits of device serial number.

Source code in src/ctsgen3/registers/registers.py
185
186
187
188
189
190
191
192
class SERIAL_NUMBER_LO_0x50(ctypes.LittleEndianStructure):
    """
    Upper 32bits of device serial number.
    """

    _fields_ = [("serial_lo", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

SERIAL_NUMBER_HI_0x54

Upper word of device serial number.

Source code in src/ctsgen3/registers/registers.py
198
199
200
201
202
203
204
205
class SERIAL_NUMBER_HI_0x54(ctypes.LittleEndianStructure):
    """
    Upper word of device serial number.
    """

    _fields_ = [("serial_hi", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

FW_VERSION_0x58

Firmware semantic version.

Source code in src/ctsgen3/registers/registers.py
211
212
213
214
215
216
217
218
219
220
221
222
223
class FW_VERSION_0x58(ctypes.LittleEndianStructure):
    """
    Firmware semantic version.
    """

    _fields_ = [
        ("patch", ctypes.c_uint8),
        ("minor", ctypes.c_uint8),
        ("major", ctypes.c_uint8),
        ("_reserved", ctypes.c_uint8),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

FOV_LENS_0x5C

FOV lens identifier.

Source code in src/ctsgen3/registers/registers.py
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
class FOV_LENS_0x5C(ctypes.LittleEndianStructure):
    """
    FOV lens identifier.
    """

    _fields_ = [
        ("lens_index", ctypes.c_uint32, 6),  # bit   0 -  5
        ("assembly_type_generation_index", ctypes.c_uint32, 6),  # bit   6 - 11
        ("lens_material_index", ctypes.c_uint32, 4),  # bit  12 - 15
        ("config_type_index", ctypes.c_uint32, 6),  # bit  16 - 21
        ("metadata_version", ctypes.c_uint32, 5),  # bit  22 - 26
        ("die_type_index", ctypes.c_uint32, 5),
    ]  # bit  27 - 31
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

DECENTRATION_0x60

Lens centration point as <7,3> fixed point numbers, and the row and column start indices for cropping the thermal image.

Source code in src/ctsgen3/registers/registers.py
249
250
251
252
253
254
255
256
257
258
259
260
261
class DECENTRATION_0x60(ctypes.LittleEndianStructure):
    """
    Lens centration point as <7,3> fixed point numbers, and the row and column start indices for cropping the thermal image.
    """

    _fields_ = [
        ("centre_x", ctypes.c_uint32, 10),  # bit   0 -  9
        ("centre_y", ctypes.c_uint32, 10),  # bit  10 - 19
        ("column_start", ctypes.c_uint32, 6),  # bit  20 - 25
        ("row_start", ctypes.c_uint32, 6),  # bit  26 - 31
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

CALIB_PARAMS_0x64

Thermal image rows and columns after cropping, black body temperature @ dY=0 and climate chamber (ambient) temperature @dY=0.

Source code in src/ctsgen3/registers/registers.py
267
268
269
270
271
272
273
274
275
276
277
278
279
class CALIB_PARAMS_0x64(ctypes.LittleEndianStructure):
    """
    Thermal image rows and columns after cropping, black body temperature @ dY=0 and climate chamber (ambient) temperature @dY=0.
    """

    _fields_ = [
        ("valid_rows", ctypes.c_uint32, 8),  # bit   0 - 7
        ("valid_columns", ctypes.c_uint32, 8),  # bit  8 - 15
        ("BB temp", ctypes.c_uint32, 8),  # bit  16 - 23
        ("CC temp", ctypes.c_uint32, 8),  # bit  24 - 31
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

CV_VERSION_0x68

Computer vision semantic version.

Source code in src/ctsgen3/registers/registers.py
285
286
287
288
289
290
291
292
293
294
295
296
297
class CV_VERSION_0x68(ctypes.LittleEndianStructure):
    """
    Computer vision semantic version.
    """

    _fields_ = [
        ("patch", ctypes.c_uint8),
        ("minor", ctypes.c_uint8),
        ("major", ctypes.c_uint8),
        ("_reserved", ctypes.c_uint8),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

FW_GIT_COMMIT_0x6C

Firmware git commit hash.

Source code in src/ctsgen3/registers/registers.py
303
304
305
306
307
308
309
310
311
312
class FW_GIT_COMMIT_0x6C(ctypes.LittleEndianStructure):
    """
    Firmware git commit hash.
    """

    _fields_ = [
        ("hash", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

CV_GIT_COMMIT_0x70

Computer vision git commit hash.

Source code in src/ctsgen3/registers/registers.py
318
319
320
321
322
323
324
325
326
327
class CV_GIT_COMMIT_0x70(ctypes.LittleEndianStructure):
    """
    Computer vision git commit hash.
    """

    _fields_ = [
        ("hash", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

RESERVED_0x74_0x78

Unimplemented.

Source code in src/ctsgen3/registers/registers.py
333
334
335
336
337
338
339
340
341
342
343
class RESERVED_0x74_0x78(ctypes.LittleEndianStructure):
    """
    Unimplemented.
    """

    _fields_ = [
        ("_reserved0", ctypes.c_uint32),
        ("_reserved1", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.RESERVED

CIS_frame_rate_enum

CIS FPS settings which populate FRAME_RATE_MODE in CTS_CTRL_0x7C

Source code in src/ctsgen3/registers/registers.py
349
350
351
352
353
354
355
356
357
class CIS_frame_rate_enum(IntEnum):
    """
    CIS FPS settings which populate `FRAME_RATE_MODE` in [CTS_CTRL_0x7C][ctsgen3.registers.registers.CTS_CTRL_0x7C]
    """

    FPS_60 = 0  #: 60 FPS (default)
    FPS_32 = 1  #: 32 FPS
    FPS_8 = 2  #: 8 FPS
    FPS_1 = 3  #: 1 FPS

CTS_CTRL_0x7C

Flags enabling image processing techniques, # frames used to average (2^NUM_FRAMES_TO_AVG), frame rate (FRAME_RATE_MODE as CIS_frame_rate)

Source code in src/ctsgen3/registers/registers.py
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
class CTS_CTRL_0x7C(ctypes.LittleEndianStructure):
    """
    Flags enabling image processing techniques, # frames used to average (2^NUM_FRAMES_TO_AVG), frame rate (FRAME_RATE_MODE as CIS_frame_rate)
    """

    _fields_ = [
        ("EXPOSURE_CTRL_ENABLE_BIT", ctypes.c_uint32, 1),  # bit   0
        ("BAD_PIXEL_ENABLE_BIT", ctypes.c_uint32, 1),  # bit   1
        ("_reserved2", ctypes.c_uint32, 1),  # bit   2
        ("_reserved3", ctypes.c_uint32, 1),  # bit   3
        ("LINEAR_COMP_ENABLE_BIT", ctypes.c_uint32, 1),  # bit   4
        ("DX_CENTROID_ENABLE_BIT", ctypes.c_uint32, 1),  # bit   5
        ("_reserved6", ctypes.c_uint32, 1),  # bit   6
        ("SHIELDED_COMP_ENABLE_BIT", ctypes.c_uint32, 1),  # bit   7
        ("NUM_FRAMES_TO_AVG", ctypes.c_uint32, 3),  # bits  8 - 10
        ("_reserved11", ctypes.c_uint32, 1),  # bit  11
        ("FRAME_RATE_MODE", ctypes.c_uint32, 4),  # bits 12 - 15
        ("_reserved16_28", ctypes.c_uint32, 13),  # bits 16 - 28
        ("DISABLE_I2C_POLL", ctypes.c_uint32, 1),  # bit  29
        ("_reserved30_31", ctypes.c_uint32, 2),  # bit  30 - 31
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

BB_WIDTH_0x80

Default bounding box width values, 6bit unsigned.

Source code in src/ctsgen3/registers/registers.py
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
class BB_WIDTH_0x80(ctypes.LittleEndianStructure):
    """
    Default bounding box width values, 6bit unsigned.
    """

    _fields_ = [
        ("width0", ctypes.c_uint32, 6),  # bit   0 -  5
        ("reserved6_7", ctypes.c_uint32, 2),  # bit   6 -  7
        ("width1", ctypes.c_uint32, 6),  # bit   8 - 13
        ("reserved14_15", ctypes.c_uint32, 2),  # bit  14 - 15
        ("width2", ctypes.c_uint32, 6),  # bit  16 - 21
        ("reserved", ctypes.c_uint32, 2),  # bit  22 - 23
        ("width3", ctypes.c_uint32, 6),  # bit  24 - 29
        ("reserved22_23", ctypes.c_uint32, 2),  # bit  29 - 31
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

BB_HEIGHT_0x84

Default bounding box height values, 6bit unsigned.

Source code in src/ctsgen3/registers/registers.py
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
class BB_HEIGHT_0x84(ctypes.LittleEndianStructure):
    """
    Default bounding box height values, 6bit unsigned.
    """

    _fields_ = [
        ("height0", ctypes.c_uint32, 6),  # bit   0 -  5
        ("reserved6_7", ctypes.c_uint32, 2),  # bit   6 -  7
        ("height1", ctypes.c_uint32, 6),  # bit   8 - 13
        ("reserved14_15", ctypes.c_uint32, 2),  # bit  14 - 15
        ("height2", ctypes.c_uint32, 6),  # bit  16 - 21
        ("reserved", ctypes.c_uint32, 2),  # bit  22 - 23
        ("height3", ctypes.c_uint32, 6),  # bit  24 - 29
        ("reserved22_23", ctypes.c_uint32, 2),  # bit  29 - 31
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

THRES_0x88

Default bounding box threshold values, 6bit unsigned.

Source code in src/ctsgen3/registers/registers.py
432
433
434
435
436
437
438
439
440
441
442
443
444
class THRES_0x88(ctypes.LittleEndianStructure):
    """
    Default bounding box threshold values, 6bit unsigned.
    """

    _fields_ = [
        ("thres0", ctypes.c_uint8),
        ("thres1", ctypes.c_uint8),
        ("thres2", ctypes.c_uint8),
        ("thres3", ctypes.c_uint8),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

TEMP_OFFSET_0x8C

Per pixel constant temperature offset C for image processing and CIS constant temperature offset E as <8,8> fixed point numbers.

Source code in src/ctsgen3/registers/registers.py
450
451
452
453
454
455
456
457
458
459
460
class TEMP_OFFSET_0x8C(ctypes.LittleEndianStructure):
    """
    Per pixel constant temperature offset `C` for image processing and CIS constant temperature offset `E` as <8,8> fixed point numbers.
    """

    _fields_ = [
        ("conv_temp_offset", ctypes.c_int16),
        ("is_temp_offset", ctypes.c_int16),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_LUMITGT_0x90

Target accumulated luminosity.

Source code in src/ctsgen3/registers/registers.py
466
467
468
469
470
471
472
473
class EXPCTRL_LUMITGT_0x90(ctypes.LittleEndianStructure):
    """
    Target accumulated luminosity.
    """

    _fields_ = [("luminosity_target", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_LUMITHS_0x94

Accumulated luminosity threshold

Source code in src/ctsgen3/registers/registers.py
479
480
481
482
483
484
485
486
class EXPCTRL_LUMITHS_0x94(ctypes.LittleEndianStructure):
    """
    Accumulated luminosity threshold
    """

    _fields_ = [("luminosity_thresh", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_EXPMAX_0x98

Maximum corrected exposure value.

Source code in src/ctsgen3/registers/registers.py
492
493
494
495
496
497
498
499
class EXPCTRL_EXPMAX_0x98(ctypes.LittleEndianStructure):
    """
    Maximum corrected exposure value.
    """

    _fields_ = [("exposure_max", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_EXPMIN_0x9C

Minimum corrected exposure value.

Source code in src/ctsgen3/registers/registers.py
505
506
507
508
509
510
511
512
class EXPCTRL_EXPMIN_0x9C(ctypes.LittleEndianStructure):
    """
    Minimum corrected exposure value.
    """

    _fields_ = [("exposure_min", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_CONFIG_0xA0

Exposure correction step value.

Source code in src/ctsgen3/registers/registers.py
518
519
520
521
522
523
524
525
526
527
528
class EXPCTRL_CONFIG_0xA0(ctypes.LittleEndianStructure):
    """
    Exposure correction step value.
    """

    _fields_ = [
        ("exposure_correction", ctypes.c_uint32, 10),
        ("_reserved10_31", ctypes.c_uint32, 22),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

SHIELDED_COMP_CONFIG_0xA4

Constant multiplier for shielded compensation value as a <8,8> signed integer.

Source code in src/ctsgen3/registers/registers.py
534
535
536
537
538
539
540
541
542
543
544
class SHIELDED_COMP_CONFIG_0xA4(ctypes.LittleEndianStructure):
    """
    Constant multiplier for shielded compensation value as a <8,8> signed integer.
    """

    _fields_ = [
        ("shielded_multiplier", ctypes.c_int16),
        ("_reserved16_31", ctypes.c_uint16),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_LUMIBBTGT_0xA8

Target accumulated luminosity of bounding boxes only.

Source code in src/ctsgen3/registers/registers.py
550
551
552
553
554
555
556
557
class EXPCTRL_LUMIBBTGT_0xA8(ctypes.LittleEndianStructure):
    """
    Target accumulated luminosity of bounding boxes only.
    """

    _fields_ = [("bb_luminosity_target", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

EXPCTRL_LUMIBBTHS_0xAC

Accumulated luminosity threshold of bounding boxes only.

Source code in src/ctsgen3/registers/registers.py
563
564
565
566
567
568
569
570
class EXPCTRL_LUMIBBTHS_0xAC(ctypes.LittleEndianStructure):
    """
    Accumulated luminosity threshold of bounding boxes only.
    """

    _fields_ = [("bb_luminosity_thresh", ctypes.c_uint32)]
    _pack_ = 1
    _access_ = AccessType.READ_WRITE

RESERVED_0xB0_0xEC

Unimplemented.

Source code in src/ctsgen3/registers/registers.py
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
class RESERVED_0xB0_0xEC(ctypes.LittleEndianStructure):
    """
    Unimplemented.
    """

    _fields_ = [
        ("_reserved0", ctypes.c_uint32),
        ("_reserved1", ctypes.c_uint32),
        ("_reserved2", ctypes.c_uint32),
        ("_reserved3", ctypes.c_uint32),
        ("_reserved4", ctypes.c_uint32),
        ("_reserved5", ctypes.c_uint32),
        ("_reserved6", ctypes.c_uint32),
        ("_reserved7", ctypes.c_uint32),
        ("_reserved8", ctypes.c_uint32),
        ("_reserved9", ctypes.c_uint32),
        ("_reserved10", ctypes.c_uint32),
        ("_reserved11", ctypes.c_uint32),
        ("_reserved12", ctypes.c_uint32),
        ("_reserved13", ctypes.c_uint32),
        ("_reserved14", ctypes.c_uint32),
        ("_reserved15", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.RESERVED

IR_RESOLUTION_0xF0

Full thermal image pixel dimensions without cropping.

Source code in src/ctsgen3/registers/registers.py
606
607
608
609
610
611
612
613
614
615
616
617
class IR_RESOLUTION_0xF0(ctypes.LittleEndianStructure):
    """
    Full thermal image pixel dimensions without cropping.
    """

    _fields_ = [
        ("ir_rows", ctypes.c_uint8),
        ("ir_cols", ctypes.c_uint8),
        ("_reserved16_31", ctypes.c_uint16),
    ]
    _pack_ = 1
    _access_ = AccessType.READ_ONLY

RESERVED_0xF4_0xFC

Unimplemented.

Source code in src/ctsgen3/registers/registers.py
623
624
625
626
627
628
629
630
631
632
633
634
class RESERVED_0xF4_0xFC(ctypes.LittleEndianStructure):
    """
    Unimplemented.
    """

    _fields_ = [
        ("_reserved0", ctypes.c_uint32),
        ("_reserved1", ctypes.c_uint32),
        ("_reserved2", ctypes.c_uint32),
    ]
    _pack_ = 1
    _access_ = AccessType.RESERVED

RegisterMap

This struct is laid out exactly as it appears in memory, and maps each register address to its corresponding ctypes structure.

Each field corresponds to one or more 32-bit metadata registers.

Source code in src/ctsgen3/registers/registers.py
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
class RegisterMap(ctypes.LittleEndianStructure):
    """

    This struct is laid out exactly as it appears in memory, and maps each register address
    to its corresponding ctypes structure.

    Each field corresponds to one or more 32-bit metadata registers.
    """

    _fields_ = [
        ("TEMP_SENSOR_0x00", TEMP_SENSOR_0x00),
        ("RESERVED_0x04", RESERVED_0x04),
        ("GLOBAL_FRM_CNT_0x08", GLOBAL_FRM_CNT_0x08),
        ("RESERVED_0x0C_0x10", RESERVED_0x0C_0x10),
        ("EXPOSURE_0x14", EXPOSURE_0x14),
        ("LUMINOSITY_0x18", LUMINOSITY_0x18),
        ("IS_TEMP_0x1C", IS_TEMP_0x1C),
        ("LINEAR_COMP_INST_0x20", LINEAR_COMP_INST_0x20),
        ("LINEAR_COMP_AVG_0x24", LINEAR_COMP_AVG_0x24),
        ("SHIELDED_COMP_INST_0x28", SHIELDED_COMP_INST_0x28),
        ("SHIELDED_COMP_AVG_0x2C", SHIELDED_COMP_AVG_0x2C),
        ("RESERVED_0x30_0x4C", RESERVED_0x30_0x4C),
        ("SERIAL_NUMBER_LO_0x50", SERIAL_NUMBER_LO_0x50),
        ("SERIAL_NUMBER_HI_0x54", SERIAL_NUMBER_HI_0x54),
        ("FW_VERSION_0x58", FW_VERSION_0x58),
        ("FOV_LENS_0x5C", FOV_LENS_0x5C),
        ("DECENTRATION_0x60", DECENTRATION_0x60),
        ("CALIB_PARAMS_0x64", CALIB_PARAMS_0x64),
        ("CV_VERSION_0x68", CV_VERSION_0x68),
        ("FW_GIT_COMMIT_0x6C", FW_GIT_COMMIT_0x6C),
        ("CV_GIT_COMMIT_0x70", CV_GIT_COMMIT_0x70),
        ("RESERVED_0x74_0x78", RESERVED_0x74_0x78),
        ("CTS_CTRL_0x7C", CTS_CTRL_0x7C),
        ("BB_WIDTH_0x80", BB_WIDTH_0x80),
        ("BB_HEIGHT_0x84", BB_HEIGHT_0x84),
        ("THRES_0x88", THRES_0x88),
        ("TEMP_OFFSET_0x8C", TEMP_OFFSET_0x8C),
        ("EXPCTRL_LUMITGT_0x90", EXPCTRL_LUMITGT_0x90),
        ("EXPCTRL_LUMITHS_0x94", EXPCTRL_LUMITHS_0x94),
        ("EXPCTRL_EXPMAX_0x98", EXPCTRL_EXPMAX_0x98),
        ("EXPCTRL_EXPMIN_0x9C", EXPCTRL_EXPMIN_0x9C),
        ("EXPCTRL_CONFIG_0xA0", EXPCTRL_CONFIG_0xA0),
        ("SHIELDED_COMP_CONFIG_0xA4", SHIELDED_COMP_CONFIG_0xA4),
        ("EXPCTRL_LUMIBBTGT_0xA8", EXPCTRL_LUMIBBTGT_0xA8),
        ("EXPCTRL_LUMIBBTHS_0xAC", EXPCTRL_LUMIBBTHS_0xAC),
        ("RESERVED_0xB0_0xEC", RESERVED_0xB0_0xEC),
        ("IR_RESOLUTION_0xF0", IR_RESOLUTION_0xF0),
        ("RESERVED_0xF4_0xFC", RESERVED_0xF4_0xFC),
    ]
    _pack_ = 1

    @classmethod
    def byte_offset(cls, name: str) -> int:
        """
        Return the byte offset of the 32-bit register field called `name`.
        Raises KeyError if no such field exists.
        """
        offset = 0
        for field_name, field_type, *_ in cls._fields_:  # <-- star here
            if field_name == name:
                return offset
            offset += ctypes.sizeof(field_type)
        raise KeyError(f"No such register field: {name!r}")

byte_offset(name) classmethod

Return the byte offset of the 32-bit register field called name. Raises KeyError if no such field exists.

Source code in src/ctsgen3/registers/registers.py
691
692
693
694
695
696
697
698
699
700
701
702
@classmethod
def byte_offset(cls, name: str) -> int:
    """
    Return the byte offset of the 32-bit register field called `name`.
    Raises KeyError if no such field exists.
    """
    offset = 0
    for field_name, field_type, *_ in cls._fields_:  # <-- star here
        if field_name == name:
            return offset
        offset += ctypes.sizeof(field_type)
    raise KeyError(f"No such register field: {name!r}")