Skip to content

Commit

Permalink
ENH: made serial and visa baud rate init parameter compatible with ea…
Browse files Browse the repository at this point in the history
…ch other
  • Loading branch information
mjmucha committed Jan 9, 2024
1 parent d3cd239 commit feaa8df
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions basil/TL/Serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ 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:
self._init["baudrate"] = self._init["baud_rate"]
del self._init["baud_rate"]

Check warning on line 43 in basil/TL/Serial.py

View check run for this annotation

Codecov / codecov/patch

basil/TL/Serial.py#L41-L43

Added lines #L41 - L43 were not covered by tests

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
5 changes: 5 additions & 0 deletions basil/TL/Visa.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ 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 layes (serial)
if "baudrate" in self._init:
self._init["baud_rate"] = self._init["baudrate"]
del self._init["baudrate"]

Check warning on line 44 in basil/TL/Visa.py

View check run for this annotation

Codecov / codecov/patch

basil/TL/Visa.py#L43-L44

Added lines #L43 - L44 were not covered by tests

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 feaa8df

Please sign in to comment.