Commit 7eb0d38f authored by Olivier Kaufmann's avatar Olivier Kaufmann
Browse files

Adds option in ohmpi_card_3_15 to create a ctl if ctl config is passed as a dict

Showing with 5 additions and 1 deletion
+5 -1
...@@ -9,7 +9,7 @@ from threading import Barrier ...@@ -9,7 +9,7 @@ from threading import Barrier
class CtlAbstract(ABC): class CtlAbstract(ABC):
def __init__(self, **kwargs): def __init__(self, **kwargs):
self.board_name = kwargs.pop('board_name', 'unknown CTL hardware') self.board_name = kwargs.pop('board_name', 'unknown CTL hardware')
self.bus = None # TODO: allow for several buses self.bus = None # TODO: allow for several buses
self.exec_logger = kwargs.pop('exec_logger', None) self.exec_logger = kwargs.pop('exec_logger', None)
if self.exec_logger is None: if self.exec_logger is None:
self.exec_logger = create_stdout_logger('exec_ctl') self.exec_logger = create_stdout_logger('exec_ctl')
......
...@@ -82,6 +82,8 @@ class Tx(TxAbstract): ...@@ -82,6 +82,8 @@ class Tx(TxAbstract):
self.current_adjustable = False self.current_adjustable = False
if self.ctl is None: if self.ctl is None:
self.ctl = ctl_module.Ctl() self.ctl = ctl_module.Ctl()
elif self.ctl is isinstance(dict):
self.ctl = ctl_module.Ctl(dict)
# I2C connexion to MCP23008, for current injection # I2C connexion to MCP23008, for current injection
self.mcp_board = MCP23008(self.ctl.bus, address=TX_CONFIG['mcp_board_address']) self.mcp_board = MCP23008(self.ctl.bus, address=TX_CONFIG['mcp_board_address'])
...@@ -204,6 +206,8 @@ class Rx(RxAbstract): ...@@ -204,6 +206,8 @@ class Rx(RxAbstract):
super().__init__(**kwargs) super().__init__(**kwargs)
if self.ctl is None: if self.ctl is None:
self.ctl = ctl_module.Ctl() self.ctl = ctl_module.Ctl()
elif self.ctl is isinstance(dict):
self.ctl = ctl_module.Ctl(dict)
# ADS1115 for voltage measurement (MN) # ADS1115 for voltage measurement (MN)
self._ads_voltage_address = 0x49 self._ads_voltage_address = 0x49
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment