Skip to content

Commit a90ab5e

Browse files
authored
patch for thinkpulse (#307)
Added brainflow config support and support for the OpenBCI Cyton ThinkPulse active electrodes #307
1 parent 1dfa52c commit a90ab5e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

eegnb/devices/eeg.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ def __init__(
7070
other=None,
7171
ip_addr=None,
7272
ch_names=None,
73+
config=None,
7374
make_logfile=False):
7475
"""The initialization function takes the name of the EEG device and determines whether or not
7576
the device belongs to the Muse or Brainflow families and initializes the appropriate backend.
@@ -87,6 +88,7 @@ def __init__(
8788
self.mac_address = mac_addr
8889
self.ip_addr = ip_addr
8990
self.other = other
91+
self.config = config
9092
self.make_logfile = make_logfile # currently only used for kf
9193
self.backend = self._get_backend(self.device_name)
9294
self.initialize_backend()
@@ -311,6 +313,16 @@ def _init_brainflow(self):
311313
self.board = BoardShim(self.brainflow_id, self.brainflow_params)
312314
self.board.prepare_session()
313315

316+
# Apply board configuration if provided
317+
if self.config:
318+
# For Cyton boards, split config string by 'X' delimiter and apply each setting
319+
if 'cyton' in self.device_name:
320+
config_settings = self.config.split('X')
321+
for setting in config_settings:
322+
self.board.config_board(setting + 'X')
323+
else:
324+
self.board.config_board(self.config)
325+
314326
def _start_brainflow(self):
315327
# only start stream if non exists
316328
if not self.stream_started:

0 commit comments

Comments
 (0)