From 087ee5f35a21c5437669067777f9d17a7c0d87ca Mon Sep 17 00:00:00 2001 From: MatthieuDartiailh Date: Wed, 30 Sep 2020 22:18:15 -0400 Subject: [PATCH] gpib: fix int to bytes conversion --- pyvisa_py/gpib.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyvisa_py/gpib.py b/pyvisa_py/gpib.py index 41ae62c3..5164e226 100644 --- a/pyvisa_py/gpib.py +++ b/pyvisa_py/gpib.py @@ -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 @@ -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]]: