Skip to content

Commit a7bd30b

Browse files
committed
2 parents f10b94b + 7b2e41d commit a7bd30b

117 files changed

Lines changed: 2220 additions & 771 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy_cpp_libs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,11 @@ jobs:
7070
cmake-version: '3.21.x'
7171
- name: Install Ninja
7272
if: (matrix.os == 'macos-14')
73-
uses: seanmiddleditch/gha-setup-ninja@master
74-
with:
75-
version: 1.10.2
73+
run: |
74+
if ! command -v ninja; then
75+
brew install ninja
76+
fi
77+
ninja --version
7678
# build simpleble outside from brainflow because of different deployment targets
7779
- name: Compile SimpleBLE MacOS
7880
if: (matrix.os == 'macos-14')

.github/workflows/run_unix.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ jobs:
4545
npm install -g ts-node
4646
- name: Install Ninja
4747
if: (matrix.os == 'macos-14')
48-
uses: seanmiddleditch/gha-setup-ninja@master
49-
with:
50-
version: 1.10.2
48+
run: |
49+
if ! command -v ninja; then
50+
brew install ninja
51+
fi
52+
ninja --version
5153
- name: Install Julia
5254
uses: julia-actions/setup-julia@v2
5355
with:

cpp_package/src/board_shim.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,18 @@ int BoardShim::get_board_id ()
282282
return master_board_id;
283283
}
284284

285+
int BoardShim::get_board_sampling_rate (int preset)
286+
{
287+
int sampling_rate = -1;
288+
int res =
289+
::get_board_sampling_rate (preset, &sampling_rate, board_id, serialized_params.c_str ());
290+
if (res != (int)BrainFlowExitCodes::STATUS_OK)
291+
{
292+
throw BrainFlowException ("failed to get board sampling rate", res);
293+
}
294+
return sampling_rate;
295+
}
296+
285297
//////////////////////////////////////////
286298
///////////// data desc methods //////////
287299
//////////////////////////////////////////
@@ -496,6 +508,18 @@ std::vector<int> BoardShim::get_ppg_channels (int board_id, int preset)
496508
return std::vector<int> (channels, channels + len);
497509
}
498510

511+
std::vector<int> BoardShim::get_optical_channels (int board_id, int preset)
512+
{
513+
int channels[MAX_CHANNELS];
514+
int len = 0;
515+
int res = ::get_optical_channels (board_id, preset, channels, &len);
516+
if (res != (int)BrainFlowExitCodes::STATUS_OK)
517+
{
518+
throw BrainFlowException ("failed to get board info", res);
519+
}
520+
return std::vector<int> (channels, channels + len);
521+
}
522+
499523
std::vector<int> BoardShim::get_accel_channels (int board_id, int preset)
500524
{
501525
int channels[MAX_CHANNELS];

cpp_package/src/inc/board_shim.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,13 @@ class BoardShim
138138
*/
139139
static std::vector<int> get_ppg_channels (
140140
int board_id, int preset = (int)BrainFlowPresets::DEFAULT_PRESET);
141+
/**
142+
* get row indices which hold optical data
143+
* @param board_id board id of your device
144+
* @throw BrainFlowException If this board has no such data exit code is UNSUPPORTED_BOARD_ERROR
145+
*/
146+
static std::vector<int> get_optical_channels (
147+
int board_id, int preset = (int)BrainFlowPresets::DEFAULT_PRESET);
141148
/**
142149
* get row indices which hold EDA data
143150
* @param board_id board id of your device
@@ -255,6 +262,8 @@ class BoardShim
255262
int num_samples, int preset = (int)BrainFlowPresets::DEFAULT_PRESET);
256263
/// Get board id, for some boards can be different than provided (playback, streaming)
257264
int get_board_id ();
265+
/// get actual sampling rate for prepared board session
266+
int get_board_sampling_rate (int preset = (int)BrainFlowPresets::DEFAULT_PRESET);
258267
/// get number of packages in ringbuffer
259268
int get_board_data_count (int preset = (int)BrainFlowPresets::DEFAULT_PRESET);
260269
/// get all collected data and flush it from internal buffer

csharp_package/brainflow/brainflow/board_controller_library.cs

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ public enum BoardIds
122122
OB3000_24_CHANNELS_BOARD = 63,
123123
BIOLISTENER_BOARD = 64,
124124
IRONBCI_32_BOARD = 65,
125-
NEUROPAWN_KNIGHT_BOARD_IMU = 66
125+
NEUROPAWN_KNIGHT_BOARD_IMU = 66,
126+
MUSE_S_ANTHENA_BOARD = 67
126127
};
127128

128129

@@ -159,6 +160,8 @@ public static class BoardControllerLibrary64
159160
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
160161
public static extern int get_sampling_rate (int board_id, int preset, int[] sampling_rate);
161162
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
163+
public static extern int get_board_sampling_rate (int preset, int[] sampling_rate, int board_id, string input_json);
164+
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
162165
public static extern int get_timestamp_channel (int board_id, int preset, int[] timestamp_channel);
163166
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
164167
public static extern int get_marker_channel (int board_id, int preset, int[] marker_channel);
@@ -181,6 +184,8 @@ public static class BoardControllerLibrary64
181184
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
182185
public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len);
183186
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
187+
public static extern int get_optical_channels (int board_id, int preset, int[] channels, int[] len);
188+
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
184189
public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len);
185190
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
186191
public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len);
@@ -249,6 +254,8 @@ public static class BoardControllerLibrary32
249254
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
250255
public static extern int get_sampling_rate (int board_id, int preset, int[] sampling_rate);
251256
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
257+
public static extern int get_board_sampling_rate (int preset, int[] sampling_rate, int board_id, string input_json);
258+
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
252259
public static extern int get_timestamp_channel (int board_id, int preset, int[] timestamp_channel);
253260
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
254261
public static extern int get_marker_channel (int board_id, int preset, int[] marker_channel);
@@ -271,6 +278,8 @@ public static class BoardControllerLibrary32
271278
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
272279
public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len);
273280
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
281+
public static extern int get_optical_channels (int board_id, int preset, int[] channels, int[] len);
282+
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
274283
public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len);
275284
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
276285
public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len);
@@ -535,6 +544,19 @@ public static int get_sampling_rate (int board_id, int preset, int[] sampling_ra
535544
return (int)BrainFlowExitCodes.GENERAL_ERROR;
536545
}
537546

547+
public static int get_board_sampling_rate (int preset, int[] sampling_rate, int board_id, string input_json)
548+
{
549+
switch (PlatformHelper.get_library_environment ())
550+
{
551+
case LibraryEnvironment.x64:
552+
return BoardControllerLibrary64.get_board_sampling_rate (preset, sampling_rate, board_id, input_json);
553+
case LibraryEnvironment.x86:
554+
return BoardControllerLibrary32.get_board_sampling_rate (preset, sampling_rate, board_id, input_json);
555+
}
556+
557+
return (int)BrainFlowExitCodes.GENERAL_ERROR;
558+
}
559+
538560
public static int get_package_num_channel (int board_id, int preset, int[] package_num)
539561
{
540562
switch (PlatformHelper.get_library_environment ())
@@ -756,6 +778,19 @@ public static int get_ppg_channels (int board_id, int preset, int[] channels, in
756778
return (int)BrainFlowExitCodes.GENERAL_ERROR;
757779
}
758780

781+
public static int get_optical_channels (int board_id, int preset, int[] channels, int[] len)
782+
{
783+
switch (PlatformHelper.get_library_environment ())
784+
{
785+
case LibraryEnvironment.x64:
786+
return BoardControllerLibrary64.get_optical_channels (board_id, preset, channels, len);
787+
case LibraryEnvironment.x86:
788+
return BoardControllerLibrary32.get_optical_channels (board_id, preset, channels, len);
789+
}
790+
791+
return (int)BrainFlowExitCodes.GENERAL_ERROR;
792+
}
793+
759794
public static int get_accel_channels (int board_id, int preset, int[] channels, int[] len)
760795
{
761796
switch (PlatformHelper.get_library_environment ())

csharp_package/brainflow/brainflow/board_descr.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class BoardDescr
1818
[DataMember]
1919
public int[] ppg_channels;
2020
[DataMember]
21+
public int[] optical_channels;
22+
[DataMember]
2123
public int[] eda_channels;
2224
[DataMember]
2325
public int[] accel_channels;
@@ -54,6 +56,7 @@ public BoardDescr ()
5456
exg_channels = null;
5557
emg_channels = null;
5658
ppg_channels = null;
59+
optical_channels = null;
5760
eda_channels = null;
5861
accel_channels = null;
5962
rotation_channels = null;

csharp_package/brainflow/brainflow/board_shim.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,30 @@ public static int[] get_ppg_channels (int board_id, int preset = (int)BrainFlowP
441441
return result;
442442
}
443443

444+
/// <summary>
445+
/// get row indices which hold optical data
446+
/// </summary>
447+
/// <param name="board_id"></param>
448+
/// <param name="preset">preset for device</param>
449+
/// <returns>array of row nums</returns>
450+
/// <exception cref="BrainFlowException">If this board has no such data exit code is UNSUPPORTED_BOARD_ERROR</exception>
451+
public static int[] get_optical_channels (int board_id, int preset = (int)BrainFlowPresets.DEFAULT_PRESET)
452+
{
453+
int[] len = new int[1];
454+
int[] channels = new int[512];
455+
int res = BoardControllerLibrary.get_optical_channels (board_id, preset, channels, len);
456+
if (res != (int)BrainFlowExitCodes.STATUS_OK)
457+
{
458+
throw new BrainFlowError (res);
459+
}
460+
int[] result = new int[len[0]];
461+
for (int i = 0; i < len[0]; i++)
462+
{
463+
result[i] = channels[i];
464+
}
465+
return result;
466+
}
467+
444468
/// <summary>
445469
/// get row indices which hold accel data
446470
/// </summary>
@@ -839,6 +863,22 @@ public int get_board_id ()
839863
return master_board;
840864
}
841865

866+
/// <summary>
867+
/// get actual sampling rate for this prepared board session
868+
/// </summary>
869+
/// <param name="preset">preset for device</param>
870+
/// <returns>sampling rate</returns>
871+
public int get_board_sampling_rate (int preset = (int)BrainFlowPresets.DEFAULT_PRESET)
872+
{
873+
int[] val = new int[1];
874+
int res = BoardControllerLibrary.get_board_sampling_rate (preset, val, board_id, input_json);
875+
if (res != (int)BrainFlowExitCodes.STATUS_OK)
876+
{
877+
throw new BrainFlowError (res);
878+
}
879+
return val[0];
880+
}
881+
842882
///<summary>
843883
/// Get input params
844884
///</summary>

docs/BrainFlowDev.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ Instructions to build docs locally
6565

6666
Don't push changes to Docs without local verification.
6767

68-
- install `pandoc <https://pandoc.org/installing.html>`_
6968
- optional: install Doxygen, skip it if you dont understand what it is or don't need to publish your local build
7069

7170
Install requirements::

docs/Doxyfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ WARNINGS = YES
778778
# will automatically be disabled.
779779
# The default value is: YES.
780780

781-
WARN_IF_UNDOCUMENTED = YES
781+
WARN_IF_UNDOCUMENTED = NO
782782

783783
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
784784
# potential errors in the documentation, such as not documenting some parameters

docs/Examples.rst

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -664,11 +664,3 @@ Swift ICA
664664

665665
.. literalinclude:: ../swift_package/examples/tests/ica/ica.swift
666666
:language: swift
667-
668-
Notebooks
669-
------------
670-
.. toctree::
671-
672-
./notebooks/brainflow_mne
673-
./notebooks/denoising
674-
./notebooks/band_power

0 commit comments

Comments
 (0)