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
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
...
@@ -2,14 +2,13 @@ import serial
import
time
import
time
import
re
import
re
import
platform
import
platform
class
PROLOGIX_GPIB_USB
():
class
PROLOGIX_GPIB_USB
():
def
__init__
(
self
,
\
def
__init__
(
self
,
port
=
""
,
timeout
=
1
,
portFormat
=
"%d"
,
maxDeviceNum
=
9
,
verbose
=
False
,
port
=
""
,
timeout
=
1
,
\
portFormat
=
"%d"
,
maxDeviceNum
=
9
,
verbose
=
False
,
\
findDevices
=
False
):
findDevices
=
False
):
if
port
==
""
:
if
port
==
""
:
if
platform
.
system
()
==
"Linux"
:
if
platform
.
system
()
==
"Linux"
:
port
=
"/dev/ttyUSB0"
port
=
"/dev/ttyUSB0"
portFormat
=
"%d"
portFormat
=
"%d"
maxDeviceNum
=
99
maxDeviceNum
=
99
...
@@ -84,16 +83,13 @@ class PROLOGIX_GPIB_USB():
...
@@ -84,16 +83,13 @@ class PROLOGIX_GPIB_USB():
return
return
def
getDevices
(
self
):
def
getDevices
(
self
):
return
self
.
_devices
return
self
.
_devices
class
GPIB_232_485CT_A
():
class
GPIB_232_485CT_A
():
def
__init__
(
self
,
\
def
__init__
(
self
,
port
=
"/dev/ttyS0"
,
baudrate
=
9600
,
bytesize
=
serial
.
EIGHTBITS
,
port
=
"/dev/ttyS0"
,
\
parity
=
serial
.
PARITY_NONE
,
stopbits
=
serial
.
STOPBITS_ONE
,
interCharTimeout
=
None
,
baudrate
=
9600
,
bytesize
=
serial
.
EIGHTBITS
,
\
pause
=
0
,
timeout
=
10
):
parity
=
serial
.
PARITY_NONE
,
stopbits
=
serial
.
STOPBITS_ONE
,
\
self
.
_serialPort
=
serial
.
Serial
(
port
,
baudrate
,
bytesize
,
parity
,
stopbits
,
interCharTimeout
=
None
,
pause
=
0
,
timeout
=
10
):
self
.
_serialPort
=
serial
.
Serial
(
port
,
\
baudrate
,
bytesize
,
\
parity
,
stopbits
,
\
interCharTimeout
,
timeout
)
interCharTimeout
,
timeout
)
self
.
_serialPort
.
flushInput
()
self
.
_serialPort
.
flushInput
()
self
.
_pause
=
pause
self
.
_pause
=
pause
...
@@ -113,7 +109,8 @@ class GPIB_232_485CT_A():
...
@@ -113,7 +109,8 @@ class GPIB_232_485CT_A():
def
setLocal
(
self
,
hpib_address
):
def
setLocal
(
self
,
hpib_address
):
self
.
_commandStr
=
"loc "
+
str
(
hpib_address
)
+
chr
(
13
)
self
.
_commandStr
=
"loc "
+
str
(
hpib_address
)
+
chr
(
13
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
self
.
_commandCount
=
self
.
_serialPort
.
write
(
self
.
_commandStr
)
class
hpib_device
():
class
hpib_device
():
def
__init__
(
self
,
hpib_address
,
port
,
keepLocal
=
False
,
pause
=
0
):
def
__init__
(
self
,
hpib_address
,
port
,
keepLocal
=
False
,
pause
=
0
):
self
.
_hpib_address
=
hpib_address
self
.
_hpib_address
=
hpib_address
...
...
test/test_hpib.py
View file @
f23b9ca7
...
@@ -98,5 +98,6 @@ class PrologixGpibUsbTest(unittest.TestCase):
...
@@ -98,5 +98,6 @@ class PrologixGpibUsbTest(unittest.TestCase):
with
self
.
assertRaises
(
ValueError
):
with
self
.
assertRaises
(
ValueError
):
hpib
.
PROLOGIX_GPIB_USB
(
port
=
"device"
)
hpib
.
PROLOGIX_GPIB_USB
(
port
=
"device"
)
if
__name__
==
'__main__'
:
if
__name__
==
'__main__'
:
unittest
.
main
()
unittest
.
main
()
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