Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
auke.klazema
HPIB
Commits
28c322a9
Commit
28c322a9
authored
Feb 16, 2018
by
auke.klazema
Browse files
Fixed pep8 line sep between methods
parent
433bb897
Changes
1
Show whitespace changes
Inline
Side-by-side
hpib.py
View file @
28c322a9
...
...
@@ -59,6 +59,7 @@ class PROLOGIX_GPIB_USB():
else
:
self
.
_devices
=
"Not scanned."
self
.
_hpib_address
=
-
1
def
command
(
self
,
hpib_address
,
commandStr
):
if
hpib_address
!=
self
.
_hpib_address
:
self
.
_commandStr
=
"++addr "
+
str
(
hpib_address
)
+
chr
(
10
)
...
...
@@ -67,6 +68,7 @@ class PROLOGIX_GPIB_USB():
self
.
_commandStr
=
""
self
.
_commandStr
+=
commandStr
+
chr
(
10
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
def
query
(
self
,
hpib_address
,
queryStr
,
count
=
80
):
if
hpib_address
!=
self
.
_hpib_address
:
self
.
_commandStr
=
"++addr "
+
str
(
hpib_address
)
+
chr
(
10
)
...
...
@@ -77,10 +79,12 @@ class PROLOGIX_GPIB_USB():
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
self
.
_returnStr
=
self
.
_serialPort
.
readline
()
return
self
.
_returnStr
[:
-
1
]
def
setLocal
(
self
,
hpib_address
):
#self._commandStr = "++addr "+str(hpib_address)+chr(10)+"loc "+str(hpib_address)+chr(10)
#self._commandCount = self._serialPort.write(self._commandStr)
return
def
getDevices
(
self
):
return
self
.
_devices
...
...
@@ -93,9 +97,11 @@ class GPIB_232_485CT_A():
interCharTimeout
,
timeout
)
self
.
_serialPort
.
flushInput
()
self
.
_pause
=
pause
def
command
(
self
,
hpib_address
,
commandStr
):
self
.
_commandStr
=
"wr "
+
str
(
hpib_address
)
+
chr
(
10
)
+
commandStr
+
chr
(
13
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
def
query
(
self
,
hpib_address
,
queryStr
,
count
=
80
):
# flushInput should not be necessary
# self._serialPort.flushInput()
...
...
@@ -106,6 +112,7 @@ class GPIB_232_485CT_A():
self
.
_returnStr
=
self
.
_serialPort
.
read
(
count
)
self
.
_returnCnt
=
int
(
self
.
_serialPort
.
readline
())
return
self
.
_returnStr
[:
self
.
_returnCnt
-
1
]
def
setLocal
(
self
,
hpib_address
):
self
.
_commandStr
=
"loc "
+
str
(
hpib_address
)
+
chr
(
13
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
...
...
@@ -117,19 +124,23 @@ class hpib_device():
self
.
_port
=
port
self
.
_keepLocal
=
keepLocal
self
.
_pause
=
pause
def
keepRemote
(
self
,
keepRemote
=
False
):
self
.
_keepLocal
=
not
keepRemote
def
setLocal
(
self
,
set2Local
=
True
):
if
set2Local
:
self
.
_port
.
setLocal
(
self
.
_hpib_address
)
def
command
(
self
,
commandStr
):
self
.
_port
.
command
(
self
.
_hpib_address
,
commandStr
)
self
.
setLocal
(
self
.
_keepLocal
)
time
.
sleep
(
self
.
_pause
)
def
query
(
self
,
queryStr
):
self
.
_answerStr
=
self
.
_port
.
query
(
self
.
_hpib_address
,
queryStr
)
self
.
setLocal
(
self
.
_keepLocal
)
return
self
.
_answerStr
def
getDevices
(
self
):
return
[
"Not implemented"
]
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment