diff --git a/eegnb/devices/eeg.py b/eegnb/devices/eeg.py index f34599029..e3e872b8a 100644 --- a/eegnb/devices/eeg.py +++ b/eegnb/devices/eeg.py @@ -70,6 +70,7 @@ def __init__( other=None, ip_addr=None, ch_names=None, + config=None, make_logfile=False): """The initialization function takes the name of the EEG device and determines whether or not the device belongs to the Muse or Brainflow families and initializes the appropriate backend. @@ -87,6 +88,7 @@ def __init__( self.mac_address = mac_addr self.ip_addr = ip_addr self.other = other + self.config = config self.make_logfile = make_logfile # currently only used for kf self.backend = self._get_backend(self.device_name) self.initialize_backend() @@ -311,6 +313,16 @@ def _init_brainflow(self): self.board = BoardShim(self.brainflow_id, self.brainflow_params) self.board.prepare_session() + # Apply board configuration if provided + if self.config: + # For Cyton boards, split config string by 'X' delimiter and apply each setting + if 'cyton' in self.device_name: + config_settings = self.config.split('X') + for setting in config_settings: + self.board.config_board(setting + 'X') + else: + self.board.config_board(self.config) + def _start_brainflow(self): # only start stream if non exists if not self.stream_started: