Add Linux support to tmc example

Replaces visa include with pyvisa, as visa use with PyVISA is being
deprecated.
This commit is contained in:
Jeremiah McCarthy 2021-03-16 17:04:40 -04:00
parent 62d4652f86
commit dc2f00cca1

View File

@ -1,6 +1,6 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import visa import pyvisa as visa
import time import time
import sys import sys
@ -142,8 +142,16 @@ def test_stall_ep0():
assert (inst.read_stb() == 0) assert (inst.read_stb() == 0)
os = sys.platform
if os == "linux" or os == "linux2":
rm = visa.ResourceManager("@py")
elif os == "darwin":
## Not tested
print("Mac not tested\n");
sys.exit()
elif os == "win32":
rm = visa.ResourceManager("/c/Windows/system32/visa64.dll")
rm = visa.ResourceManager("/c/Windows/system32/visa64.dll")
reslist = rm.list_resources("USB?::?*::INSTR") reslist = rm.list_resources("USB?::?*::INSTR")
print(reslist) print(reslist)