Skip to content

Commit

Permalink
packets for 32 channels BLE
Browse files Browse the repository at this point in the history
  • Loading branch information
salman2135 committed Feb 12, 2024
1 parent d355eea commit d4e897c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/explorepy/explore.py
Expand Up @@ -257,6 +257,8 @@ def convert_bin(self, bin_file, out_dir='', file_type='edf', do_overwrite=False,
self.mask = [1 for _ in range(0, 32)]
if 'PCB_305_801_XXX' in self.stream_processor.device_info['board_id']:
self.mask = [1 for _ in range(0, 16)]
if 'PCB_304_801p2_X' in self.stream_processor.device_info['board_id']:
self.mask = [1 for _ in range(0, 32)]

self.recorders['exg'] = create_exg_recorder(filename=exg_out_file,
file_type=self.recorders['file_type'],
Expand Down
8 changes: 8 additions & 0 deletions src/explorepy/packet.py
Expand Up @@ -31,6 +31,7 @@ class PACKET_ID(IntEnum):
EEG32 = 148
EEG98_USBC = 150
EEG98_BLE = 151
EEG32_BLE = 152
EEG99 = 62
EEG94R = 208
EEG98R = 210
Expand Down Expand Up @@ -206,6 +207,12 @@ class EEG98_BLE(EEG):
def __init__(self, timestamp, payload, time_offset=0):
super().__init__(timestamp, payload, time_offset, v_ref=2.4, n_packet=1)

class EEG32_BLE(EEG):
"""EEG packet for 32 channel BLE device"""

def __init__(self, timestamp, payload, time_offset=0):
super().__init__(timestamp, payload, time_offset, v_ref=2.4, n_packet=1)


class EEG99(EEG):
"""EEG packet for 8 channel device"""
Expand Down Expand Up @@ -577,6 +584,7 @@ def _convert(self, bin_data):
PACKET_ID.EEG98R: EEG98,
PACKET_ID.EEG98_USBC: EEG98_USBC,
PACKET_ID.EEG98_BLE: EEG98_BLE,
PACKET_ID.EEG32_BLE: EEG32_BLE,
PACKET_ID.EEG32: EEG32,
PACKET_ID.CMDRCV: CommandRCV,
PACKET_ID.CMDSTAT: CommandStatus,
Expand Down
8 changes: 8 additions & 0 deletions src/explorepy/settings_manager.py
Expand Up @@ -119,6 +119,14 @@ def update_device_settings(self, device_info_dict_update):
hardware_adc = self.settings_dict.get(self.hardware_channel_mask_key)
self.settings_dict[self.software_channel_mask_key] = hardware_adc
self.settings_dict[self.adc_mask_key] = self.settings_dict.get(self.software_channel_mask_key)
if "board_id" in device_info_dict_update:
if self.settings_dict["board_id"] == "PCB_304_801p2_X":
self.settings_dict[self.channel_count_key] = 32
self.settings_dict[self.hardware_channel_mask_key] = [1 for _ in range(32)]
if self.software_channel_mask_key not in self.settings_dict:
hardware_adc = self.settings_dict.get(self.hardware_channel_mask_key)
self.settings_dict[self.software_channel_mask_key] = hardware_adc
self.settings_dict[self.adc_mask_key] = self.settings_dict.get(self.software_channel_mask_key)

if self.channel_count_key not in self.settings_dict:
self.settings_dict[self.channel_count_key] = 8 if sum(self.settings_dict["adc_mask"]) > 4 else 4
Expand Down

0 comments on commit d4e897c

Please sign in to comment.