Stream data#

Channel IDs, stream settings and the callback types data arrives through. See Streaming data for the chunk layout.

eeg_channel.h#

EEG data stream channel ID constants.

Author

Neurotechnology (brainaccess@neurotechnology.com)

Copyright

Copyright (c) 2022 Neurotechnology

Defines

BA_EEG_CHANNEL_ID_SAMPLE_NUMBER#

The number of the sample starting from 0 at the stream start.

Data type: size_t

BA_EEG_CHANNEL_ID_ELECTRODE_MEASUREMENT#

EEG electrode measurement value (uV)

Data type: double

In impedance measurement mode (ba_eeg_manager_set_impedance_mode) it is the electrode’s impedance in kOhm instead.

BA_EEG_CHANNEL_ID_ELECTRODE_CONTACT_P#

Whether the positive (P) electrode is making contact with the skin.

Data type: bool

BA_EEG_CHANNEL_ID_ELECTRODE_CONTACT#

Whether the electrode is making contact with the skin.

Data type: bool

If the device has separate P and N electrodes, the value will be true only if both electrodes are making contact.

Enabling it makes the device measure the electrode even when its BA_EEG_CHANNEL_ID_ELECTRODE_MEASUREMENT channel is off, since contact is detected only on a measured electrode; see ba_eeg_manager_set_channel_enabled.

BA_EEG_CHANNEL_ID_ELECTRODE_CONTACT_N#

Whether the negative (N) electrode is making contact with the skin.

Data type: bool

BA_EEG_CHANNEL_ID_DIGITAL_INPUT#

Digital input state, one value per sample.

Data type: uint8_t, 0 (low) or 1 (high)

The level of the first ADS1299’s GPIO1 pin, sampled by the device with every conversion. Enable it with ba_eeg_manager_set_channel_enabled before the stream starts; start_stream then asks the device to send it. Firmware without the stream-options service cannot, and the channel stays 0 (a warning is logged). Rows filled in for lost samples (STREAMING 0) are 0. In impedance mode a row is one sweep of the channels and carries the input at the sweep’s last conversion.

BA_EEG_CHANNEL_ID_GYROSCOPE#

Gyroscope angular velocity, in degrees per second.

Data type: float

One channel per axis: BA_EEG_CHANNEL_ID_GYROSCOPE + 0, 1 and 2 for x, y and z. Only on devices with a gyroscope (ba_core_device_features_has_gyro).

BA_EEG_CHANNEL_ID_ACCELEROMETER#

Accelerometer acceleration, in m/s^2.

Data type: float

One channel per axis: BA_EEG_CHANNEL_ID_ACCELEROMETER + 0, 1 and 2 for x, y and z. Only on devices with an accelerometer (ba_core_device_features_has_accel).

BA_EEG_CHANNEL_ID_STREAMING#

Whether the sample was received from the device.

Data type: uint8_t, 1 for a received sample, 0 for a row the library filled in for a sample lost on the way. A filled-in row keeps its sample number; its contact, motion and digital input values are 0, and its electrode values are 0 (in impedance mode, the previous row’s).

Typedefs

typedef uint16_t ba_eeg_channel#

Type for representing EEG data stream channel IDs.

callbacks.h#

Callback function typedefs.

Author

Neurotechnology (brainaccess@neurotechnology.com)

Copyright

Copyright (c) 2022 Neurotechnology

Typedefs

typedef void (*ba_callback_chunk)(const void *const *data, size_t data_size, void *user_data)#

Callback function for handling EEG data stream chunks.

data holds one pointer per stream channel (row), ordered by channel ID. Find a channel’s row with ba_eeg_manager_get_channel_index; data[row] then points to data_size values of that channel, one per sample, of the type given for the channel in eeg_channel.h (also returned by ba_eeg_manager_get_stream_channel_data_types). The arrays belong to the library and are valid only until the callback returns: copy what you keep.

Param data:

Array of pointers to each stream channel’s values

Param data_size:

Number of samples in this chunk

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_battery)(const ba_battery_info *battery_info, void *user_data)#

Callback function for handling battery information updates.

Param battery_info:

Pointer to the battery information structure

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_disconnect)(void *user_data)#

Callback function for handling device disconnection events.

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_future_void)(void *user_data)#

Callback function for handling future void results.

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_ota_update)(void *user_data, const size_t reserved1, const size_t reserved2)#

Callback function for the result of a firmware (OTA) update.

Called once by ba_eeg_manager_start_update, only when the device accepted the image. Both size arguments are 0.

Param user_data:

User-defined data passed to the callback function

Param reserved1:

Always 0

Param reserved2:

Always 0

typedef void (*ba_callback_future_bool)(bool result, void *user_data)#

Callback function for handling future boolean results.

Param result:

Boolean result

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_future_float)(float result, void *user_data)#

Callback function for handling future float results.

Param result:

Float result

Param user_data:

User-defined data passed to the callback function

typedef void (*ba_callback_future_full_battery_info)(const ba_full_battery_info *result, void *user_data)#

Callback function for handling future full battery information results.

Param result:

Pointer to the full battery information structure

Param user_data:

User-defined data passed to the callback function

stream_rate.h#

Defines data stream rate constants and type for BA core.

This header provides symbolic constants for various data stream rates (in Hz) and a typedef for the data stream rate type used throughout the BA core system. No device supports every rate listed: see ba_eeg_manager_set_data_stream_rate for the rates of each device.

Defines

BA_DATA_STREAM_RATE_16K_HZ#

16 kHz data stream rate

BA_DATA_STREAM_RATE_8K_HZ#

8 kHz data stream rate

BA_DATA_STREAM_RATE_4K_HZ#

4 kHz data stream rate

BA_DATA_STREAM_RATE_2K_HZ#

2 kHz data stream rate

BA_DATA_STREAM_RATE_1K_HZ#

1 kHz data stream rate

BA_DATA_STREAM_RATE_500_HZ#

500 Hz data stream rate

BA_DATA_STREAM_RATE_250_HZ#

250 Hz data stream rate

Typedefs

typedef uint8_t ba_data_stream_rate#

Data stream rate type: one of the BA_DATA_STREAM_RATE_* values.

gain_mode.h#

Gain mode.

Author

Neurotechnology (brainaccess@neurotechnology.com)

Copyright

Copyright (c) 2022 Neurotechnology

Defines

BA_GAIN_MODE_X1#

1x gain

BA_GAIN_MODE_X2#

2x gain

BA_GAIN_MODE_X4#

4x gain

BA_GAIN_MODE_X6#

6x gain

BA_GAIN_MODE_X8#

8x gain

BA_GAIN_MODE_X12#

12x gain

BA_GAIN_MODE_UNKNOWN#

Unknown gain.

Typedefs

typedef uint8_t ba_gain_mode#

Gain mode type.

Functions

int ba_gain_mode_to_multiplier(ba_gain_mode g)#

Converts gain mode to integer multiplier representing the gain mode (ex: X12 returns 12)

Parameters:

g – Gain mode to convert to multiplier

Returns:

Integer multiplier representing the gain mode (ex: X12 returns 12)

ba_gain_mode ba_multiplier_to_gain_mode(int g)#

Attempts to convert multiplier to gain mode (ex: 12 returns X12)

Parameters:

g – Multiplier to convert to gain mode

Returns:

Gain mode

impedance_measurement_mode.h#

Impedance measurement mode constants.

Author

Neurotechnology (brainaccess@neurotechnology.com)

Copyright

Copyright (c) 2022 Neurotechnology

Defines

BA_IMPEDANCE_MEASUREMENT_MODE_OFF#

No active impedance measurement.

BA_IMPEDANCE_MEASUREMENT_MODE_HZ_7_8#

7.8 Hz wave; always streamed at 250 Hz

BA_IMPEDANCE_MEASUREMENT_MODE_HZ_31_2#

31.2 Hz wave; streamed at 250 Hz above 1 kHz

BA_IMPEDANCE_MEASUREMENT_MODE_DR_DIV4#

Wave frequency of sample_rate/4.

Typedefs

typedef uint8_t ba_impedance_measurement_mode#

Impedance measurement mode type: one of the BA_IMPEDANCE_MEASUREMENT_MODE_* values.

output_mode.h#

Device output (streaming) mode.

Author

Neurotechnology (brainaccess@neurotechnology.com)

Copyright

Copyright (c) 2022 Neurotechnology

Defines

BA_OUTPUT_MODE_NORMAL#

Normal EEG readings from the electrodes.

BA_OUTPUT_MODE_SQUARE_WAVE#

Internally generated square-wave test signal (debug)

Typedefs

typedef uint8_t ba_output_mode#

Device output mode type.