Skip to content

Commit

Permalink
Merge pull request #209 from SiLab-Bonn/consistent_init_configuration
Browse files Browse the repository at this point in the history
serial and visa baud rate init parameter compatibility
  • Loading branch information
cbespin committed May 3, 2024
2 parents b94290a + 15d3a5e commit 9982f22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions basil/TL/Serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ def init(self):
logger.debug(e)
self.timeout = self._init.get('timeout', None) # timeout of 0 returns immediately

# make interface compatible with other transfer layes (visa)
if "baud_rate" in self._init.keys():
self._init["baudrate"] = self._init.pop("baud_rate")

self._port = serial.Serial(**{key: value for key, value in self._init.items() if key not in ("read_termination", "write_termination")})

def close(self):
Expand Down
4 changes: 4 additions & 0 deletions basil/TL/Visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ def init(self):
except NotImplementedError: # some backends do not always implement the list_resources function
logger.info('BASIL VISA TL with %s backend', backend)

# make interface compatible with other transfer layers (serial)
if "baudrate" in self._init.keys():
self._init["baud_rate"] = self._init.pop("baudrate")

self._resource = rm.open_resource(**{key: value for key, value in self._init.items() if key not in ("backend",)})

def close(self):
Expand Down

0 comments on commit 9982f22

Please sign in to comment.