Skip to content

Commit

Permalink
gpib: fix int to bytes conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthieuDartiailh committed Oct 1, 2020
1 parent 38e0e26 commit 087ee5f
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions pyvisa_py/gpib.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from pyvisa.rname import GPIBInstr, GPIBIntfc

from .sessions import Session, UnknownAttribute
from .common import int_to_byte

try:
GPIB_CTYPES = True
Expand Down Expand Up @@ -82,21 +83,21 @@ class GPIBCommand(bytes, Enum):

# Talker
@staticmethod
def MTA(board_pad):
return chr(40 + board_pad)
def MTA(board_pad) -> bytes:
return int_to_byte(40 + board_pad)

# Listener
@staticmethod
def MLA(device_pad):
return chr(20 + device_pad)
def MLA(device_pad) -> bytes:
return int_to_byte(20 + device_pad)

# Listener secondary address
# for VISA SAD range from 1 to 31 and 0 is not SAD
@staticmethod
def MSA(device_sad):
def MSA(device_sad) -> bytes:
if device_sad == 0:
return b""
return chr(95 + device_sad)
return int_to_byte(95 + device_sad)


def _find_boards() -> Iterator[Tuple[int, int]]:
Expand Down

0 comments on commit 087ee5f

Please sign in to comment.