Skip to content
GitLab
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
f23b9ca7
Commit
f23b9ca7
authored
Feb 16, 2018
by
auke.klazema
Browse files
Fixed pep8 lines issues and unneeded \
parent
92da2f8a
Changes
2
Hide whitespace changes
Inline
Side-by-side
hpib.py
View file @
f23b9ca7
...
...
@@ -2,14 +2,13 @@ import serial
import
time
import
re
import
platform
class
PROLOGIX_GPIB_USB
():
def
__init__
(
self
,
\
port
=
""
,
timeout
=
1
,
\
portFormat
=
"%d"
,
maxDeviceNum
=
9
,
verbose
=
False
,
\
def
__init__
(
self
,
port
=
""
,
timeout
=
1
,
portFormat
=
"%d"
,
maxDeviceNum
=
9
,
verbose
=
False
,
findDevices
=
False
):
if
port
==
""
:
if
platform
.
system
()
==
"Linux"
:
if
platform
.
system
()
==
"Linux"
:
port
=
"/dev/ttyUSB0"
portFormat
=
"%d"
maxDeviceNum
=
99
...
...
@@ -84,16 +83,13 @@ class PROLOGIX_GPIB_USB():
return
def
getDevices
(
self
):
return
self
.
_devices
class
GPIB_232_485CT_A
():
def
__init__
(
self
,
\
port
=
"/dev/ttyS0"
,
\
baudrate
=
9600
,
bytesize
=
serial
.
EIGHTBITS
,
\
parity
=
serial
.
PARITY_NONE
,
stopbits
=
serial
.
STOPBITS_ONE
,
\
interCharTimeout
=
None
,
pause
=
0
,
timeout
=
10
):
self
.
_serialPort
=
serial
.
Serial
(
port
,
\
baudrate
,
bytesize
,
\
parity
,
stopbits
,
\
def
__init__
(
self
,
port
=
"/dev/ttyS0"
,
baudrate
=
9600
,
bytesize
=
serial
.
EIGHTBITS
,
parity
=
serial
.
PARITY_NONE
,
stopbits
=
serial
.
STOPBITS_ONE
,
interCharTimeout
=
None
,
pause
=
0
,
timeout
=
10
):
self
.
_serialPort
=
serial
.
Serial
(
port
,
baudrate
,
bytesize
,
parity
,
stopbits
,
interCharTimeout
,
timeout
)
self
.
_serialPort
.
flushInput
()
self
.
_pause
=
pause
...
...
@@ -113,7 +109,8 @@ class GPIB_232_485CT_A():
def
setLocal
(
self
,
hpib_address
):
self
.
_commandStr
=
"loc "
+
str
(
hpib_address
)
+
chr
(
13
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
class
hpib_device
():
def
__init__
(
self
,
hpib_address
,
port
,
keepLocal
=
False
,
pause
=
0
):
self
.
_hpib_address
=
hpib_address
...
...
test/test_hpib.py
View file @
f23b9ca7
...
...
@@ -98,5 +98,6 @@ class PrologixGpibUsbTest(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
):
hpib
.
PROLOGIX_GPIB_USB
(
port
=
"device"
)
if
__name__
==
'__main__'
:
unittest
.
main
()
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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