1 # SPDX-License-Identifier: GPL-2.0+
3 This file helps to extract string names of NI signals as included in comedi.h
4 between NI_NAMES_BASE and NI_NAMES_BASE+NI_NUM_NAMES.
7 # This is simply to aide in creating the entries in the order of the value of
8 # the device-global NI signal/terminal constants defined in comedi.h
22 'NI_CtrArmStartTrigger',
23 'NI_CtrInternalOutput',
31 # load all the static names; start with those that do not begin with NI_
32 name_dict['PXI_Star'] = comedi_h.PXI_Star
33 name_dict['PXI_Clk10'] = comedi_h.PXI_Clk10
35 #load all macro values
37 f = getattr(comedi_h, fun)
39 '{}({})'.format(fun,i):f(i) for i in range(1 + f(-1) - f(0))
42 #load everything else in ni_common_signal_names enum
44 k:v for k,v in comedi_h.__dict__.items()
45 if k.startswith('NI_') and (not callable(v)) and
46 comedi_h.NI_COUNTER_NAMES_MAX < v < (comedi_h.NI_NAMES_BASE + comedi_h.NI_NUM_NAMES)
49 # now create reverse lookup (value -> name)
51 val_dict = {v:k for k,v in name_dict.items()}
53 return name_dict, val_dict
55 name_to_value, value_to_name = get_ni_names()