Pilxi 5.2__tar.gz → 5.4__tar.gz

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.
Files changed (41) hide show
  1. {Pilxi-5.2 → pilxi-5.4}/PKG-INFO +5 -1
  2. {Pilxi-5.2 → pilxi-5.4}/Pilxi.egg-info/PKG-INFO +5 -1
  3. {Pilxi-5.2 → pilxi-5.4}/Pilxi.egg-info/SOURCES.txt +5 -0
  4. {Pilxi-5.2 → pilxi-5.4}/README.md +4 -0
  5. pilxi-5.4/examples/41-625/Example_ArbitraryWave_Generation.py +63 -0
  6. pilxi-5.4/examples/41-625/Example_MultiChannel_Generation.py +103 -0
  7. pilxi-5.4/examples/41-625/Example_Pulse_Generation.py +69 -0
  8. pilxi-5.4/examples/41-625/Example_Sine_Generation.py +98 -0
  9. pilxi-5.4/examples/41-625/Example_Trigger.py +93 -0
  10. {Pilxi-5.2 → pilxi-5.4}/pilxi/__init__.py +316 -3
  11. {Pilxi-5.2 → pilxi-5.4}/pyproject.toml +1 -1
  12. {Pilxi-5.2 → pilxi-5.4}/setup.py +1 -1
  13. {Pilxi-5.2 → pilxi-5.4}/LXIpxm78xx/__init__.py +0 -0
  14. {Pilxi-5.2 → pilxi-5.4}/Pilxi.egg-info/dependency_links.txt +0 -0
  15. {Pilxi-5.2 → pilxi-5.4}/Pilxi.egg-info/requires.txt +0 -0
  16. {Pilxi-5.2 → pilxi-5.4}/Pilxi.egg-info/top_level.txt +0 -0
  17. {Pilxi-5.2 → pilxi-5.4}/examples/Example_41-620_FunctionGenerator.py +0 -0
  18. {Pilxi-5.2 → pilxi-5.4}/examples/Example_41-743_PowerSupply.py +0 -0
  19. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Attenuator.py +0 -0
  20. {Pilxi-5.2 → pilxi-5.4}/examples/Example_BatterySimulator.py +0 -0
  21. {Pilxi-5.2 → pilxi-5.4}/examples/Example_CurrentLoopSimulator.py +0 -0
  22. {Pilxi-5.2 → pilxi-5.4}/examples/Example_DIO_Mux_card_piplx_LXI_PXI.py +0 -0
  23. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Discovery.py +0 -0
  24. {Pilxi-5.2 → pilxi-5.4}/examples/Example_ListCards.py +0 -0
  25. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Matrix.py +0 -0
  26. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Matrix_SetCrosspointRange.py +0 -0
  27. {Pilxi-5.2 → pilxi-5.4}/examples/Example_MultiUser.py +0 -0
  28. {Pilxi-5.2 → pilxi-5.4}/examples/Example_OpenByAlias.py +0 -0
  29. {Pilxi-5.2 → pilxi-5.4}/examples/Example_PXM78xx.py +0 -0
  30. {Pilxi-5.2 → pilxi-5.4}/examples/Example_PowerSequencer.py +0 -0
  31. {Pilxi-5.2 → pilxi-5.4}/examples/Example_PrecisionResistor.py +0 -0
  32. {Pilxi-5.2 → pilxi-5.4}/examples/Example_ReleaseSessions.py +0 -0
  33. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Resolver.py +0 -0
  34. {Pilxi-5.2 → pilxi-5.4}/examples/Example_StrainGauge.py +0 -0
  35. {Pilxi-5.2 → pilxi-5.4}/examples/Example_SubunitStates.py +0 -0
  36. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Switching.py +0 -0
  37. {Pilxi-5.2 → pilxi-5.4}/examples/Example_Thermocouple.py +0 -0
  38. {Pilxi-5.2 → pilxi-5.4}/pi620lx/__init__.py +0 -0
  39. {Pilxi-5.2 → pilxi-5.4}/pi743lx/__init__.py +0 -0
  40. {Pilxi-5.2 → pilxi-5.4}/pipslx/__init__.py +0 -0
  41. {Pilxi-5.2 → pilxi-5.4}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Pilxi
3
- Version: 5.2
3
+ Version: 5.4
4
4
  Summary: Python wrapper Library for Pickering LXI ClientBridge driver
5
5
  Home-page:
6
6
  Author: Pickering Interfaces
@@ -12,6 +12,7 @@ Requires-Dist: enum34
12
12
  # Python wrapper Library for Pickering LXI ClientBridge driver #
13
13
 
14
14
  Python wrapper Library for Pickering LXI ClientBridge driver. It supports both Python 2.x and 3.x.
15
+ For PIFGLX functionality a C++ ClientBridge >= 1.80.0 is needed.
15
16
 
16
17
  ----------
17
18
  # Installation Instructions #
@@ -26,6 +27,9 @@ Please note that there is an additional dependency 'enum34' for Python 2.x and P
26
27
  ----------
27
28
  # ChangeLog #
28
29
 
30
+ > - 5.4 - Support for ClientBridge versions prior to 1.80.0
31
+ > - 5.3 - Added PIFGLX wrapper.
32
+ - Added StatusCodeToMessage function.
29
33
  > - 5.2 - Addded ATTR_C_GA_SLOT_ADDRESS attribute, updated readme.
30
34
  > - 5.1 - Updated description and readme.
31
35
  > - 5.0 - Adds SetAttributeDWORD, SetAttributeDWORDArray, SetAttributeDouble, SetAttributeByte and its getters. Adds DioAllPortData function.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Pilxi
3
- Version: 5.2
3
+ Version: 5.4
4
4
  Summary: Python wrapper Library for Pickering LXI ClientBridge driver
5
5
  Home-page:
6
6
  Author: Pickering Interfaces
@@ -12,6 +12,7 @@ Requires-Dist: enum34
12
12
  # Python wrapper Library for Pickering LXI ClientBridge driver #
13
13
 
14
14
  Python wrapper Library for Pickering LXI ClientBridge driver. It supports both Python 2.x and 3.x.
15
+ For PIFGLX functionality a C++ ClientBridge >= 1.80.0 is needed.
15
16
 
16
17
  ----------
17
18
  # Installation Instructions #
@@ -26,6 +27,9 @@ Please note that there is an additional dependency 'enum34' for Python 2.x and P
26
27
  ----------
27
28
  # ChangeLog #
28
29
 
30
+ > - 5.4 - Support for ClientBridge versions prior to 1.80.0
31
+ > - 5.3 - Added PIFGLX wrapper.
32
+ - Added StatusCodeToMessage function.
29
33
  > - 5.2 - Addded ATTR_C_GA_SLOT_ADDRESS attribute, updated readme.
30
34
  > - 5.1 - Updated description and readme.
31
35
  > - 5.0 - Adds SetAttributeDWORD, SetAttributeDWORDArray, SetAttributeDouble, SetAttributeByte and its getters. Adds DioAllPortData function.
@@ -28,6 +28,11 @@ examples/Example_StrainGauge.py
28
28
  examples/Example_SubunitStates.py
29
29
  examples/Example_Switching.py
30
30
  examples/Example_Thermocouple.py
31
+ examples/41-625/Example_ArbitraryWave_Generation.py
32
+ examples/41-625/Example_MultiChannel_Generation.py
33
+ examples/41-625/Example_Pulse_Generation.py
34
+ examples/41-625/Example_Sine_Generation.py
35
+ examples/41-625/Example_Trigger.py
31
36
  pi620lx/__init__.py
32
37
  pi743lx/__init__.py
33
38
  pilxi/__init__.py
@@ -1,6 +1,7 @@
1
1
  # Python wrapper Library for Pickering LXI ClientBridge driver #
2
2
 
3
3
  Python wrapper Library for Pickering LXI ClientBridge driver. It supports both Python 2.x and 3.x.
4
+ For PIFGLX functionality a C++ ClientBridge >= 1.80.0 is needed.
4
5
 
5
6
  ----------
6
7
  # Installation Instructions #
@@ -15,6 +16,9 @@ Please note that there is an additional dependency 'enum34' for Python 2.x and P
15
16
  ----------
16
17
  # ChangeLog #
17
18
 
19
+ > - 5.4 - Support for ClientBridge versions prior to 1.80.0
20
+ > - 5.3 - Added PIFGLX wrapper.
21
+ - Added StatusCodeToMessage function.
18
22
  > - 5.2 - Addded ATTR_C_GA_SLOT_ADDRESS attribute, updated readme.
19
23
  > - 5.1 - Updated description and readme.
20
24
  > - 5.0 - Adds SetAttributeDWORD, SetAttributeDWORDArray, SetAttributeDouble, SetAttributeByte and its getters. Adds DioAllPortData function.
@@ -0,0 +1,63 @@
1
+ """Sample program for Pickering LXI 41-625 Function Generator"""
2
+
3
+ """Sample program for Pickering LXI 41-625 Function Generator"""
4
+
5
+ import sys
6
+
7
+ import pilxi
8
+ import os
9
+
10
+ ###############################
11
+ # Initialize session and card #
12
+ ###############################
13
+
14
+ IP_Address = "192.168.11.156"
15
+
16
+ port = 1024
17
+ timeout = 1000
18
+
19
+ bus = 4
20
+ device = 13
21
+
22
+ subunit = 1
23
+
24
+ waveform = pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE
25
+
26
+ # Connect to chassis
27
+ session = pilxi.Pi_Session(IP_Address, port, timeout)
28
+
29
+ # Open card
30
+ try:
31
+ card = session.OpenCard(bus, device)
32
+ except pilxi.Error as ex:
33
+ print("Error occurred: {}".format(ex.message))
34
+ exit()
35
+
36
+ # Get and print the Card ID
37
+ cardId = card.CardId()
38
+
39
+ print("Successfully connected to card at bus", bus, "device", device)
40
+ print("Card ID: ", cardId)
41
+
42
+ sample_source = ('{}/extras/MyARB.txt', os.getcwd())
43
+
44
+ card.PIFGLX_SetFrequency(subunit, 10000)
45
+ card.PIFGLX_CreateArbitraryWaveform(subunit, sample_source)
46
+
47
+ # Wait for user input to abort generation
48
+
49
+ if (sys.version_info > (3, 0, 0)):
50
+ input_var = input("Press Enter to continue ")
51
+ else:
52
+ input_var = raw_input("Please Enter to continue ")
53
+
54
+ ######################
55
+ # Clean up and close #
56
+ ######################
57
+ card.PIFGLX_AbortGeneration(subunit)
58
+
59
+ card.ClearCard()
60
+
61
+ card.Close()
62
+
63
+ session.Close()
@@ -0,0 +1,103 @@
1
+ """Sample program for Pickering LXI 41-625 Function Generator"""
2
+
3
+ import pilxi
4
+
5
+ ################
6
+ # Channel mask #
7
+ # 1 = ON #
8
+ # 0 = OFF #
9
+ ################
10
+
11
+ # set first 4 channels to 1
12
+ channel_state = [
13
+ 1,1,1,1
14
+ ]
15
+
16
+ # fill the rest with 0
17
+ for channel in range(len(channel_state), 32):
18
+ channel_state[channel] = 0
19
+
20
+ ############################
21
+ # Variables for generation #
22
+ ############################
23
+
24
+ waveform_type = [
25
+ pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE,
26
+ pilxi.WaveformTypes.PIFGLX_WAVEFORM_SQUARE,
27
+ pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE,
28
+ pilxi.WaveformTypes.PIFGLX_WAVEFORM_SQUARE
29
+ ]
30
+
31
+ amplitude = [
32
+ 25,
33
+ 15,
34
+ 25,
35
+ 15
36
+ ]
37
+
38
+ frequency = [
39
+ 10000,
40
+ 10000,
41
+ 10000,
42
+ 10000
43
+ ]
44
+
45
+ dc_offset = [
46
+ 0,
47
+ 2,
48
+ 0,
49
+ 2
50
+ ]
51
+
52
+ # fill the rest with 0
53
+ for channel in range(len(channel_state), 32):
54
+ channel_state[channel] = 0
55
+
56
+ ###############################
57
+ # Initialize session and card #
58
+ ###############################
59
+
60
+ IP_Address = "192.168.11.156"
61
+
62
+ port = 1024
63
+ timeout = 1000
64
+
65
+ bus = 4
66
+ device = 13
67
+
68
+ subunit = 1
69
+
70
+ # Connect to chassis
71
+ session = pilxi.Pi_Session(IP_Address, port, timeout)
72
+
73
+ # Open card
74
+ try:
75
+ card = session.OpenCard(bus, device)
76
+ except pilxi.Error as ex:
77
+ print("Error occurred: {}".format(ex.message))
78
+ exit()
79
+
80
+ # Get and print the Card ID
81
+ cardId = card.CardId()
82
+
83
+ print("Successfully connected to card at bus", bus, "device", device)
84
+ print("Card ID: ", cardId)
85
+
86
+ #########################################
87
+ # Function generator specific functions #
88
+ #########################################
89
+
90
+ # count number of enabled channels
91
+ num_channels = 0
92
+ for x in range(len(channel_state)):
93
+ if channel_state[x] == 1:
94
+ num_channels += 1
95
+
96
+
97
+ for channel in range(num_channels):
98
+ card.PIFGLX_SetWaveform(channel, waveform_type[channel])
99
+ card.PIFGLX_SetAmplitude(channel, amplitude[channel])
100
+ card.PIFGLX_SetFrequency(channel, frequency[channel])
101
+ card.PIFGLX_SetDcOffset(channel, dc_offset[channel])
102
+
103
+
@@ -0,0 +1,69 @@
1
+ """Sample program for Pickering LXI 41-625 Function Generator"""
2
+
3
+ import sys
4
+
5
+ import pilxi
6
+
7
+ ###############################
8
+ # Initialize session and card #
9
+ ###############################
10
+
11
+ IP_Address = "192.168.11.162"
12
+
13
+ port = 1024
14
+ timeout = 1000
15
+
16
+ bus = 4
17
+ device = 1
18
+
19
+ subunit = 1
20
+
21
+ waveform = pilxi.WaveformTypes.PIFGLX_WAVEFORM_PULSE
22
+
23
+ # Connect to chassis
24
+ session = pilxi.Pi_Session(IP_Address, port, timeout)
25
+
26
+ print(session.FindFreeCards())
27
+
28
+ # Open card
29
+ try:
30
+ card = session.OpenCard(bus, device)
31
+ except pilxi.Error as ex:
32
+ print("Error occurred: {}".format(ex.message))
33
+ exit()
34
+
35
+ # Get and print the Card ID
36
+ cardId = card.CardId()
37
+
38
+ print("Successfully connected to card at bus", bus, "device", device)
39
+ print("Card ID: ", cardId)
40
+
41
+ #########################################
42
+ # Function generator specific functions #
43
+ #########################################
44
+
45
+ card.PIFGLX_SetWaveform(subunit, waveform)
46
+
47
+ card.PIFGLX_SetAmplitude(subunit, 20)
48
+
49
+ card.PIFGLX_SetPulseWidth(subunit, 100)
50
+
51
+ card.PIFGLX_SetDcOffset(subunit, 2.5)
52
+
53
+ # Wait for user input to abort generation
54
+
55
+ if (sys.version_info > (3, 0, 0)):
56
+ input_var = input("Press Enter to continue ")
57
+ else:
58
+ input_var = raw_input("Please Enter to continue ")
59
+
60
+ ######################
61
+ # Clean up and close #
62
+ ######################
63
+ card.PIFGLX_AbortGeneration(subunit)
64
+
65
+ card.ClearCard()
66
+
67
+ card.Close()
68
+
69
+ session.Close()
@@ -0,0 +1,98 @@
1
+ """Sample program for Pickering LXI 41-625 Function Generator"""
2
+
3
+ """Sample program for Pickering LXI 41-625 Function Generator"""
4
+
5
+ import sys
6
+
7
+ import pilxi
8
+
9
+ ###############################
10
+ # Initialize session and card #
11
+ ###############################
12
+
13
+ IP_Address = "192.168.11.162"
14
+
15
+ port = 1024
16
+ timeout = 1000
17
+
18
+ bus = 4
19
+ device = 1
20
+
21
+ subunit = 1
22
+
23
+ waveform = pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE
24
+
25
+ # Connect to chassis
26
+ session = pilxi.Pi_Session(IP_Address, port, timeout)
27
+
28
+ # Open card
29
+ try:
30
+ card = session.OpenCard(bus, device)
31
+ except pilxi.Error as ex:
32
+ print("Error occurred: {}".format(ex.message))
33
+ exit()
34
+
35
+ # Get and print the Card ID
36
+ cardId = card.CardId()
37
+
38
+ print("Successfully connected to card at bus", bus, "device", device)
39
+ print("Card ID: ", cardId)
40
+
41
+ #########################################
42
+ # Function generator specific functions #
43
+ #########################################
44
+
45
+ card.PIFGLX_SetWaveform(subunit, pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE)
46
+
47
+ card.PIFGLX_SetAmplitude(subunit, 20)
48
+
49
+ card.PIFGLX_SetFrequency(subunit, 10000)
50
+
51
+ card.PIFGLX_SetDcOffset(subunit, 0)
52
+
53
+ do_run = 1
54
+ amplitude = 20
55
+ freq = 10000
56
+ dc_offset = 0
57
+ while(do_run):
58
+ amplitude = int(input("Set new amplitude"))
59
+ freq = int(input("Set new frequency"))
60
+ dc_offset = int(input("Set new DC Offset"))
61
+
62
+ if (sys.version_info > (3, 0, 0)):
63
+ amplitude = input("Set new amplitude")
64
+ else:
65
+ amplitude = raw_input("Set new amplitude")
66
+
67
+ if (sys.version_info > (3, 0, 0)):
68
+ freq = int(input("Set new frequency"))
69
+ else:
70
+ freq = int(raw_input("Set new frequency"))
71
+
72
+ if (sys.version_info > (3, 0, 0)):
73
+ dc_offset = int(input("Set new DC Offset"))
74
+ else:
75
+ dc_offset = int(raw_input("Set new DC Offset"))
76
+
77
+ if(amplitude != None):
78
+ card.PIFGLX_SetAmplitude(subunit, amplitude)
79
+ if(freq != None):
80
+ card.PIFGLX_SetFrequency(subunit, freq)
81
+ if(amplitude != None):
82
+ card.PIFGLX_SetDcOffset(subunit, dc_offset)
83
+
84
+ if (sys.version_info > (3, 0, 0)):
85
+ do_run = int(input("Enter 0 to abort generation"))
86
+ else:
87
+ do_run = int(raw_input("Enter 0 to abort generation"))
88
+
89
+ ######################
90
+ # Clean up and close #
91
+ ######################
92
+ card.PIFGLX_AbortGeneration(subunit)
93
+
94
+ card.ClearCard()
95
+
96
+ card.Close()
97
+
98
+ session.Close()
@@ -0,0 +1,93 @@
1
+ """Sample program for Pickering LXI 41-625 Function Generator"""
2
+
3
+ import sys
4
+
5
+ import pilxi
6
+
7
+ ###############################
8
+ # Initialize session and card #
9
+ ###############################
10
+
11
+ IP_Address = "192.168.11.162"
12
+
13
+ port = 1024
14
+ timeout = 1000
15
+
16
+ bus = 4
17
+ device = 1
18
+
19
+ subunit = 1
20
+
21
+ waveform = pilxi.WaveformTypes.PIFGLX_WAVEFORM_SINE
22
+
23
+ amplitude = 20
24
+ frequency = 10000
25
+ dc_offset = 0
26
+ start_phase = 0
27
+ duty_cycle = 20
28
+
29
+ # Pulse waveform only
30
+ pulse_width = 150
31
+
32
+ # Connect to chassis
33
+ session = pilxi.Pi_Session(IP_Address, port, timeout)
34
+
35
+ # Open card
36
+ try:
37
+ card = session.OpenCard(bus, device)
38
+ except pilxi.Error as ex:
39
+ print("Error occurred: {}".format(ex.message))
40
+ exit()
41
+
42
+ # Get and print the Card ID
43
+ cardId = card.CardId()
44
+
45
+ print("Successfully connected to card at bus", bus, "device", device)
46
+ print("Card ID: ", cardId)
47
+
48
+ card.ClearCard()
49
+
50
+ #########################################
51
+ # Function generator specific functions #
52
+ #########################################
53
+
54
+ card.PIFGLX_SetInputTriggerConfig(pilxi.TriggerInputSource.PIFGLX_TRIG_IN_FRONT, pilxi.TriggerInputModes.PIFGLX_TRIG_IN_EDGE_RISING)
55
+
56
+ card.PIFGLX_SetOutputTriggerConfig(pilxi.TriggerOutputModes.PIFGLX_TRIG_OUT_GEN_PULSE_POS, 0)
57
+
58
+ card.PIFGLX_SetInputTriggerEnable(subunit, [1])
59
+
60
+ card.PIFGLX_SetOutputTriggerEnable(subunit, [1])
61
+
62
+ card.PIFGLX_SetWaveform(subunit, waveform)
63
+
64
+ card.PIFGLX_SetAmplitude(subunit, amplitude)
65
+
66
+ card.PIFGLX_SetDcOffset(subunit, dc_offset)
67
+
68
+ card.PIFGLX_SetFrequency(subunit, frequency)
69
+
70
+ card.PIFGLX_SetStartPhase(subunit, start_phase)
71
+
72
+ card.PIFGLX_SetDutyCycleHigh(subunit, duty_cycle)
73
+
74
+ if waveform == pilxi.WaveformTypes.PIFGLX_WAVEFORM_PULSE:
75
+ card.PIFGLX_SetPulseWidth(pulse_width)
76
+
77
+ # Wait for user input to abort generation
78
+
79
+ if (sys.version_info > (3, 0, 0)):
80
+ input_var = input("Press Enter to continue ")
81
+ else:
82
+ input_var = raw_input("Please Enter to continue ")
83
+
84
+ ######################
85
+ # Clean up and close #
86
+ ######################
87
+ card.PIFGLX_AbortGeneration(subunit)
88
+
89
+ card.ClearCard()
90
+
91
+ card.Close()
92
+
93
+ session.Close()
@@ -1,7 +1,7 @@
1
1
  # Communication module header file of ClientBridge for communication with
2
2
  # LXI device.
3
3
  #
4
- # Copyright (C) 1988 - 2020, Pickering Interfaces ltd.
4
+ # Copyright (C) 1988 - 2024, Pickering Interfaces ltd.
5
5
  #
6
6
  # Support: support@pickeringswitch.com
7
7
  # Supported OS: Mac OS 10.9.2, Windows XP/7/8/10, Linux
@@ -33,15 +33,20 @@
33
33
  #
34
34
  # 5. REDISTRIBUTION:. You may freely re-distribute Pickering software in any way
35
35
  # unless explicitly stated to the contrary for a particular product.
36
-
36
+ from ctypes import c_uint32
37
37
  from math import floor
38
38
  from sys import version_info
39
39
  import ctypes
40
40
  import platform
41
+
41
42
  from enum import IntEnum
42
43
 
43
- __version__ = "5.2"
44
+ __version__ = "5.4"
44
45
 
46
+ g_enableFG = 1
47
+ def pifglxWarning():
48
+ print("Warning: PIFLGX not found (C++ ClientBridge version >= 1.80.0 is required)")
49
+ return -1
45
50
  #region Enums
46
51
 
47
52
  class BattConversionTime(IntEnum):
@@ -286,6 +291,41 @@ class DriverModes(IntEnum):
286
291
  # Enable debug mode.
287
292
  DEBUG = 0x00010000
288
293
 
294
+ class WaveformTypes(IntEnum):
295
+ PIFGLX_WAVEFORM_SINE = 0x0,
296
+ PIFGLX_WAVEFORM_SQUARE = 0x1,
297
+ PIFGLX_WAVEFORM_TRIANGLE = 0x2,
298
+ PIFGLX_WAVEFORM_RAMP_UP = 0x3,
299
+ PIFGLX_WAVEFORM_RAMP_DOWN = 0x4,
300
+ PIFGLX_WAVEFORM_DC = 0x5,
301
+ PIFGLX_WAVEFORM_PULSE = 0x6,
302
+ PIFGLX_WAVEFORM_PWM = 0x7,
303
+ PIFGLX_WAVEFORM_ARB = 0x8
304
+
305
+ class GenerationModes(IntEnum):
306
+ PIFGLX_GEN_CONT = 0x0,
307
+ PIFGLX_GEN_ONE_SHOT = 0x1
308
+
309
+ class TriggerInputSource(IntEnum):
310
+ PIFGLX_TRIG_IN_FRONT = 0x0
311
+
312
+ class TriggerInputModes(IntEnum):
313
+ PIFGLX_TRIG_IN_EDGE_RISING = 0x0,
314
+ PIFGLX_TRIG_IN_EDGE_FALLING = 0x1
315
+
316
+ class TriggerOutputModes(IntEnum):
317
+ PIFGLX_TRIG_OUT_GEN_PULSE_POS = 0x0,
318
+ PIFGLX_TRIG_OUT_GEN_PULSE_NEG = 0x1,
319
+ PIFGLX_TRIG_OUT_SOFT_PULSE_POS = 0x2,
320
+ PIFGLX_TRIG_OUT_SOFT_PULSE_NEG = 0x3,
321
+ PIFGLX_TRIG_OUT_GEN_LEVEL_HIGH = 0x4,
322
+ PIFGLX_TRIG_OUT_GEN_LEVEL_LOW = 0x5,
323
+ PIFGLX_TRIG_OUT_SOFT_LEVEL = 0x6
324
+
325
+ class ClockSources(IntEnum):
326
+ PIFGLX_CLK_PCI = 0x0,
327
+ PIFGLX_CLK_PXI = 0x1
328
+
289
329
  #endregion
290
330
 
291
331
 
@@ -303,20 +343,41 @@ class Error(Exception):
303
343
  class Pi_Base:
304
344
  """Base class provides base functionality, LXI device discovery functions"""
305
345
  def __init__(self):
346
+ global g_enableFG
306
347
  if platform.system() == "Windows":
307
348
  arch = platform.architecture()
308
349
  if "64bit" in arch:
309
350
  self._handleCMLX = ctypes.windll.LoadLibrary("Picmlx_w64")
310
351
  self._handlePLX = ctypes.windll.LoadLibrary("Piplx_w64")
352
+ try:
353
+ self._handlePIFGLX = ctypes.windll.LoadLibrary("Pifglx_w64")
354
+ g_enableFG = 1
355
+ except Exception as e:
356
+ g_enableFG = 0
311
357
  else:
312
358
  self._handleCMLX = ctypes.windll.LoadLibrary("Picmlx_w32")
313
359
  self._handlePLX = ctypes.windll.LoadLibrary("Piplx_w32")
360
+ try:
361
+ self._handlePIFGLX = ctypes.windll.LoadLibrary("Pifglx_w32")
362
+ g_enableFG = 1
363
+ except Exception as e:
364
+ g_enableFG = 0
314
365
  elif platform.system() == "Darwin":
315
366
  self._handleCMLX = ctypes.cdll.LoadLibrary("Bin/libpicmlx.so")
316
367
  self._handlePLX = ctypes.cdll.LoadLibrary("Bin/libpiplx.so")
368
+ try:
369
+ self._handlePIFGLX = ctypes.windll.LoadLibrary("Bin/libpifglx.so")
370
+ g_enableFG = 1
371
+ except Exception as e:
372
+ g_enableFG = 0
317
373
  elif platform.system() == "Linux":
318
374
  self._handleCMLX = ctypes.cdll.LoadLibrary("libpicmlx.so")
319
375
  self._handlePLX = ctypes.cdll.LoadLibrary("libpiplx.so")
376
+ try:
377
+ self._handlePIFGLX = ctypes.cdll.LoadLibrary("libpifglx.so")
378
+ g_enableFG = 1
379
+ except Exception as e:
380
+ g_enableFG = 0
320
381
 
321
382
  self.pythonMajorVersion = version_info[0]
322
383
 
@@ -338,6 +399,15 @@ class Pi_Base:
338
399
  raise Error(errorString, errorCode=error)
339
400
  return
340
401
 
402
+ def _handlePIFGLXError(self,error):
403
+ if error:
404
+ errorString = ctypes.create_string_buffer(100)
405
+ self._handlePIFGLX.PIFGLX_ErrorCodeToMessage(error, ctypes.byref(errorString), 100)
406
+ errorString = self._pythonString(errorString.value)
407
+ raise Error(errorString, errorCode=error)
408
+ return
409
+
410
+
341
411
  def _calc_dwords(self, bits):
342
412
  dwords = (bits / 32)
343
413
  if ((bits) % 32 > 0):
@@ -983,6 +1053,16 @@ class Pi_Card_Base(Pi_Base):
983
1053
  self._handlePIPLXError(err)
984
1054
  return self._pythonString(status_message.value)
985
1055
 
1056
+ def StatusCodeToMessage(self, status_code):
1057
+ # 256 is also used by PiCommandParser - status_code is bitmask - more errors can be returned for single status
1058
+ status_length = 256
1059
+ status_message = ctypes.create_string_buffer(status_length)
1060
+ err = self._handlePLX.PIPLX_StatusCodeToMessage(status_code,
1061
+ ctypes.byref(status_message), status_length)
1062
+ self._handlePIPLXError(err)
1063
+ return self._pythonString(status_message.value)
1064
+
1065
+
986
1066
  def CardId(self):
987
1067
  bufferLength = 100
988
1068
  cardID = ctypes.create_string_buffer(bufferLength)
@@ -3230,6 +3310,239 @@ class Pi_Card_Base(Pi_Base):
3230
3310
 
3231
3311
  #endregion
3232
3312
 
3313
+ #region Function Generator
3314
+
3315
+ def PIFGLX_SetAmplitude(self, sub_num, amplitude):
3316
+ if not g_enableFG:
3317
+ return pifglxWarning()
3318
+ result = self._handlePIFGLX.PIFGLX_SetAmplitude(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(amplitude))
3319
+ self._handlePIFGLXError(result)
3320
+
3321
+ def PIFGLX_GetAmplitude(self, sub_num):
3322
+ if not g_enableFG:
3323
+ return pifglxWarning()
3324
+ amplitude = ctypes.c_double()
3325
+ result = self._handlePIFGLX.PIFGLX_GetAmplitude(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(amplitude))
3326
+ self._handlePIFGLXError(result)
3327
+ return amplitude.value
3328
+
3329
+ def PIFGLX_SetDcOffset(self, sub_num, dc_offset):
3330
+ if not g_enableFG:
3331
+ return pifglxWarning()
3332
+ result = self._handlePIFGLX.PIFGLX_SetDcOffset(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(dc_offset))
3333
+ self._handlePIFGLXError(result)
3334
+
3335
+ def PIFGLX_GetDcOffset(self, sub_num):
3336
+ if not g_enableFG:
3337
+ return pifglxWarning()
3338
+ dc_offset = ctypes.c_double()
3339
+ result = self._handlePIFGLX.PIFGLX_GetDcOffset(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(dc_offset))
3340
+ self._handlePIFGLXError(result)
3341
+ return dc_offset.value
3342
+
3343
+ def PIFGLX_SetFrequency(self, sub_num, frequency):
3344
+ if not g_enableFG:
3345
+ return pifglxWarning()
3346
+ result = self._handlePIFGLX.PIFGLX_SetFrequency(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(frequency))
3347
+ self._handlePIFGLXError(result)
3348
+
3349
+ def PIFGLX_GetFrequency(self, sub_num):
3350
+ if not g_enableFG:
3351
+ return pifglxWarning()
3352
+ frequency = ctypes.c_double()
3353
+ result = self._handlePIFGLX.PIFGLX_GetFrequency(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(frequency))
3354
+ self._handlePIFGLXError(result)
3355
+ return frequency.value
3356
+
3357
+ def PIFGLX_SetStartPhase(self, sub_num, start_phase):
3358
+ if not g_enableFG:
3359
+ return pifglxWarning()
3360
+ result = self._handlePIFGLX.PIFGLX_SetStartPhase(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(start_phase))
3361
+ self._handlePIFGLXError(result)
3362
+
3363
+ def PIFGLX_GetStartPhase(self, sub_num):
3364
+ if not g_enableFG:
3365
+ return pifglxWarning()
3366
+ start_phase = ctypes.c_double()
3367
+ result = self._handlePIFGLX.PIFGLX_GetStartPhase(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(start_phase))
3368
+ self._handlePIFGLXError(result)
3369
+ return start_phase.value
3370
+
3371
+ def PIFGLX_SetDutyCycleHigh(self, sub_num, duty_cycle_high):
3372
+ if not g_enableFG:
3373
+ return pifglxWarning()
3374
+ result = self._handlePIFGLX.PIFGLX_SetDutyCycleHigh(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(duty_cycle_high))
3375
+ self._handlePIFGLXError(result)
3376
+
3377
+ def PIFGLX_GetDutyCycleHigh(self, sub_num):
3378
+ if not g_enableFG:
3379
+ return pifglxWarning()
3380
+ duty_cycle_high = ctypes.c_double()
3381
+ result = self._handlePIFGLX.PIFGLX_GetDutyCycleHigh(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(duty_cycle_high))
3382
+ self._handlePIFGLXError(result)
3383
+ return duty_cycle_high.value
3384
+
3385
+ def PIFGLX_SetWaveform(self, sub_num, waveform):
3386
+ if not g_enableFG:
3387
+ return pifglxWarning()
3388
+ result = self._handlePIFGLX.PIFGLX_SetWaveform(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_uint32(waveform))
3389
+ self._handlePIFGLXError(result)
3390
+
3391
+ def PIFGLX_GetWaveform(self, sub_num):
3392
+ if not g_enableFG:
3393
+ return pifglxWarning()
3394
+ waveform = ctypes.c_uint32()
3395
+ result = self._handlePIFGLX.PIFGLX_GetWaveform(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(waveform))
3396
+ self._handlePIFGLXError(result)
3397
+ return waveform.value
3398
+
3399
+ def PIFGLX_SetPulseWidth(self, sub_num, pulse_width):
3400
+ if not g_enableFG:
3401
+ return pifglxWarning()
3402
+ result = self._handlePIFGLX.PIFGLX_SetPulseWidth(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_double(pulse_width))
3403
+ self._handlePIFGLXError(result)
3404
+
3405
+ def PIFGLX_GetPulseWidth(self, sub_num):
3406
+ if not g_enableFG:
3407
+ return pifglxWarning()
3408
+ pulse_width = ctypes.c_double()
3409
+ result = self._handlePIFGLX.PIFGLX_GetPulseWidth(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(pulse_width))
3410
+ self._handlePIFGLXError(result)
3411
+ return pulse_width.value
3412
+
3413
+ def PIFGLX_ConfigureWaveform(self, sub_num, waveform, amplitude, dc_offset, frequency, start_phase, duty_cycle_high, pulse_width):
3414
+ if not g_enableFG:
3415
+ return pifglxWarning()
3416
+ result = self._handlePIFGLX.PIFGLX_ConfigureWaveform(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_uint32(waveform),
3417
+ ctypes.c_double(amplitude), ctypes.c_double(dc_offset), ctypes.c_double(frequency),
3418
+ ctypes.c_double(start_phase), ctypes.c_double(duty_cycle_high), ctypes.c_double(pulse_width))
3419
+ self._handlePIFGLXError(result)
3420
+
3421
+ def PIFGLX_InitiateGeneration(self, sub_num):
3422
+ if not g_enableFG:
3423
+ return pifglxWarning()
3424
+ result = self._handlePIFGLX.PIFGLX_InitiateGeneration(self.session, self.card, ctypes.c_uint32(sub_num))
3425
+ self._handlePIFGLXError(result)
3426
+
3427
+ def PIFGLX_AbortGeneration(self, sub_num):
3428
+ if not g_enableFG:
3429
+ return pifglxWarning()
3430
+ result = self._handlePIFGLX.PIFGLX_AbortGeneration(self.session, self.card, ctypes.c_uint32(sub_num))
3431
+ self._handlePIFGLXError(result)
3432
+
3433
+ def PIFGLX_StartStopGeneration(self, state, size):
3434
+ if not g_enableFG:
3435
+ return pifglxWarning()
3436
+ state_array = (ctypes.c_uint32 * size)(*state)
3437
+ result = self._handlePIFGLX.PIFGLX_StartStopGeneration(self.session, self.card, state_array, ctypes.c_uint32(size))
3438
+ self._handlePIFGLXError(result)
3439
+
3440
+ def PIFGLX_GetGenerationState(self, sub_num, size):
3441
+ if not g_enableFG:
3442
+ return pifglxWarning()
3443
+ state = ctypes.c_uint32()
3444
+ result = self._handlePIFGLX.PIFGLX_GetGenerationState(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(state), ctypes.c_uint32(size))
3445
+ self._handlePIFGLXError(result)
3446
+ return state.value
3447
+
3448
+ def PIFGLX_CreateArbitraryWaveform(self, sub_num, sample_source):
3449
+ if not g_enableFG:
3450
+ return pifglxWarning()
3451
+ result = self._handlePIFGLX.PIFGLX_CreateArbitraryWaveform(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_char_p(sample_source.encode('utf-8')))
3452
+ self._handlePIFGLXError(result)
3453
+
3454
+ def PIFGLX_SetInputTriggerConfig(self, source, trigger):
3455
+ if not g_enableFG:
3456
+ return pifglxWarning()
3457
+ result = self._handlePIFGLX.PIFGLX_SetInputTriggerConfig(self.session, self.card, ctypes.c_uint32(source), ctypes.c_uint32(trigger))
3458
+ self._handlePIPLXError(result)
3459
+
3460
+ def PIFGLX_GetInputTriggerConfig(self):
3461
+ if not g_enableFG:
3462
+ return pifglxWarning()
3463
+ source = ctypes.c_uint32()
3464
+ trigger = ctypes.c_uint32()
3465
+ result = self._handlePIFGLX.PIFGLX_GetInputTriggerConfig(self.session, self.card, ctypes.byref(source), ctypes.byref(trigger))
3466
+ self._handlePIFGLXError(result)
3467
+ return source.value, trigger.value
3468
+
3469
+ def PIFGLX_SetOutputTriggerConfig(self, source, trigger):
3470
+ if not g_enableFG:
3471
+ return pifglxWarning()
3472
+ result = self._handlePIFGLX.PIFGLX_SetOutputTriggerConfig(self.session, self.card, ctypes.c_uint32(source), ctypes.c_uint32(trigger))
3473
+ self._handlePIPLXError(result)
3474
+
3475
+ def PIFGLX_GetOutputTriggerConfig(self):
3476
+ if not g_enableFG:
3477
+ return pifglxWarning()
3478
+ source = ctypes.c_uint32()
3479
+ trigger = ctypes.c_uint32()
3480
+ result = self._handlePIFGLX.PIFGLX_GetOutputTriggerConfig(self.session, self.card, ctypes.byref(source), ctypes.byref(trigger))
3481
+ self._handlePIFGLXError(result)
3482
+ return source.value, trigger.value
3483
+
3484
+ def PIFGLX_SetInputTriggerEnable(self, sub_num, trigger):
3485
+ if not g_enableFG:
3486
+ return pifglxWarning()
3487
+ size = ctypes.c_uint32(len(trigger))
3488
+ trigger_array = (ctypes.c_uint32 * size)(*trigger)
3489
+ result = self._handlePIFGLX.PIFGLX_SetInputTriggerEnable(self.session, self.card, ctypes.c_uint32(sub_num), trigger_array, size)
3490
+ self._handlePIFGLXError(result)
3491
+
3492
+ def PIFLGX_GetInputTriggerEnable(self, sub_num, size):
3493
+ if not g_enableFG:
3494
+ return pifglxWarning()
3495
+ trigger = (ctypes.c_uint32 * size)()
3496
+ result = self._handlePIFGLX.PIFGLX_GetInputTriggerEnable(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(trigger), ctypes.c_uint32(size))
3497
+ self._handlePIFGLXError(result)
3498
+ return [trigger[i] for i in range(size)]
3499
+
3500
+ def PIFGLX_SetOutputTriggerEnable(self, sub_num, trigger):
3501
+ if not g_enableFG:
3502
+ return pifglxWarning()
3503
+ size = ctypes.c_uint32(len(trigger))
3504
+ trigger_array = (ctypes.c_uint32 * size)(*trigger)
3505
+ result = self._handlePIFGLX.PIFGLX_SetOutputTriggerEnable(self.session, self.card, ctypes.c_uint32(sub_num), trigger_array, size)
3506
+ self._handlePIFGLXError(result)
3507
+
3508
+ def PIFLGX_GetOutputTriggerEnable(self, sub_num, size):
3509
+ if not g_enableFG:
3510
+ return pifglxWarning()
3511
+ trigger = (ctypes.c_uint32 * size)()
3512
+ result = self._handlePIFGLX.PIFGLX_GetOutputTriggerEnable(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(trigger), ctypes.c_uint32(size))
3513
+ self._handlePIFGLXError(result)
3514
+ return [trigger[i] for i in range(size)]
3515
+
3516
+ def PIFGLX_GenerateOutputTrigger(self, state):
3517
+ if not g_enableFG:
3518
+ return pifglxWarning()
3519
+ result = self._handlePIFGLX.PIFGLX_GenerateOutputTrigger(self.session, self.card, ctypes.c_uint32(state))
3520
+ self._handlePIFGLXError(result)
3521
+
3522
+ def PIFGLX_GetTriggerMonitorState(self, sub_num, size):
3523
+ if not g_enableFG:
3524
+ return pifglxWarning()
3525
+ state = (c_uint32 * size)()
3526
+ result = self._handlePIFGLX.PIFGLX_GetTriggerMonitorState(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(state), size)
3527
+ self._handlePIFGLXError(result)
3528
+ return [state[i] for i in range(size)]
3529
+
3530
+ def PIFGLX_SetClockSource(self, sub_num, source):
3531
+ if not g_enableFG:
3532
+ return pifglxWarning()
3533
+ result = self._handlePIFGLX.PIFGLX_SetClockSource(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.c_uint32(source))
3534
+ self._handlePIFGLXError(result)
3535
+
3536
+ def PIFGLX_GetClockSource(self, sub_num):
3537
+ if not g_enableFG:
3538
+ return pifglxWarning()
3539
+ source = ctypes.c_uint32()
3540
+ result = self._handlePIFGLX.PIFGLX_GetClockSource(self.session, self.card, ctypes.c_uint32(sub_num), ctypes.byref(source))
3541
+ self._handlePIFGLXError(result)
3542
+ return source.value
3543
+
3544
+ #endregion
3545
+
3233
3546
 
3234
3547
  class Pi_Card_ByAlias(Pi_Card_Base):
3235
3548
  """Pi_Card_ByAlias class opens a session and card by resource"""
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "Pilxi"
7
- version = "5.2"
7
+ version = "5.4"
8
8
  description = "Python wrapper Library for Pickering LXI ClientBridge driver"
9
9
  readme = "README.md"
10
10
  license = {file = "LICENSE.txt"}
@@ -2,7 +2,7 @@ from setuptools import setup
2
2
 
3
3
  setup(
4
4
  name='Pilxi',
5
- version='5.2',
5
+ version='5.4',
6
6
  packages=['pilxi','pipslx', "pi620lx", "pi743lx", "LXIpxm78xx"],
7
7
  url='',
8
8
  license='',
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes