-
Notifications
You must be signed in to change notification settings - Fork 1
/
devGui.py
111 lines (91 loc) · 2.99 KB
/
devGui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/usr/bin/env python3
#-----------------------------------------------------------------------------
# This file is part of the 'Simple-PGPv4-KCU105-Example'. It is subject to
# the license terms in the LICENSE.txt file found in the top-level directory
# of this distribution and at:
# https://confluence.slac.stanford.edu/display/ppareg/LICENSE.html.
# No part of the 'Simple-PGPv4-KCU105-Example', including this file, may be
# copied, modified, propagated, or distributed except according to the terms
# contained in the LICENSE.txt file.
#-----------------------------------------------------------------------------
import setupLibPaths
import sys
import time
import argparse
import pyrogue as pr
import pyrogue.pydm
import simple_pgp4_kcu105_example as devBoard
#################################################################
if __name__ == "__main__":
# Convert str to bool
argBool = lambda s: s.lower() in ['true', 't', 'yes', '1']
# Set the argument parser
parser = argparse.ArgumentParser()
# Add arguments
parser.add_argument(
"--dev",
type = str,
required = False,
default = '/dev/datadev_0',
help = "axi-pcie-core device",
)
parser.add_argument(
"--lane",
type = int,
required = False,
default = 0,
help = "DMA Lane Index",
)
parser.add_argument(
"--pollEn",
type = argBool,
required = False,
default = True,
help = "Enable auto-polling",
)
parser.add_argument(
"--initRead",
type = argBool,
required = False,
default = True,
help = "Enable read all variables at start",
)
parser.add_argument(
"--guiType",
type = str,
required = False,
default = 'PyDM',
help = "Sets the GUI type (PyDM or None)",
)
# Get the arguments
args = parser.parse_args()
#################################################################
with devBoard.Root(
dev = args.dev,
lane = args.lane,
pollEn = args.pollEn,
initRead = args.initRead,
) as root:
######################
# Development PyDM GUI
######################
if (args.guiType == 'PyDM'):
pyrogue.pydm.runPyDM(
serverList = root.zmqServer.address,
sizeX = 800,
sizeY = 800,
)
#################
# No GUI
#################
elif (args.guiType == 'None'):
# Wait to be killed via Ctrl-C
print('Running root server. Hit Ctrl-C to exit')
while (root._running):
time.sleep(1)
####################
# Undefined GUI type
####################
else:
raise ValueError("Invalid GUI type (%s)" % (args.guiType) )
#################################################################