Skip to content

Commit 7b2e41d

Browse files
authored
Add support for Muse S Anthena device (#779)
* Add support for Muse S Anthena device --------- Signed-off-by: Andrey Parfenov <a1994ndrey@gmail.com>
1 parent 8b6f97e commit 7b2e41d

35 files changed

Lines changed: 1402 additions & 21 deletions

File tree

.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: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,18 @@ std::vector<int> BoardShim::get_ppg_channels (int board_id, int preset)
508508
return std::vector<int> (channels, channels + len);
509509
}
510510

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+
511523
std::vector<int> BoardShim::get_accel_channels (int board_id, int preset)
512524
{
513525
int channels[MAX_CHANNELS];

cpp_package/src/inc/board_shim.h

Lines changed: 7 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

csharp_package/brainflow/brainflow/board_controller_library.cs

Lines changed: 19 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

@@ -183,6 +184,8 @@ public static class BoardControllerLibrary64
183184
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
184185
public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len);
185186
[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)]
186189
public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len);
187190
[DllImport ("BoardController", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
188191
public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len);
@@ -275,6 +278,8 @@ public static class BoardControllerLibrary32
275278
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
276279
public static extern int get_ppg_channels (int board_id, int preset, int[] channels, int[] len);
277280
[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)]
278283
public static extern int get_accel_channels (int board_id, int preset, int[] channels, int[] len);
279284
[DllImport ("BoardController32", SetLastError = true, CallingConvention = CallingConvention.Cdecl)]
280285
public static extern int get_rotation_channels (int board_id, int preset, int[] channels, int[] len);
@@ -773,6 +778,19 @@ public static int get_ppg_channels (int board_id, int preset, int[] channels, in
773778
return (int)BrainFlowExitCodes.GENERAL_ERROR;
774779
}
775780

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+
776794
public static int get_accel_channels (int board_id, int preset, int[] channels, int[] len)
777795
{
778796
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: 24 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>

docs/SupportedBoards.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1435,7 +1435,7 @@ Initialization Example:
14351435
params = BrainFlowInputParams()
14361436
params.serial_port = "COM3"
14371437
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
1438-
1438+
14391439
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD, params)
14401440
14411441
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**
@@ -1470,7 +1470,7 @@ Initialization Example:
14701470
params = BrainFlowInputParams()
14711471
params.serial_port = "COM3"
14721472
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
1473-
1473+
14741474
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU, params)
14751475
14761476
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**
@@ -1560,4 +1560,4 @@ Supported platforms:
15601560
- Windows
15611561
- Linux
15621562
- MacOS
1563-
- Devices like Raspberry Pi
1563+
- Devices like Raspberry Pi

emulator/brainflow_emulator/galea_manual.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def __init__(self):
3535
self.channel_on_off = [1] * 24
3636
self.channel_identifiers = [
3737
'1', '2', '3', '4', '5', '6', '7', '8',
38-
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
38+
'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I',
3939
'A', 'S', 'D', 'G', 'H', 'J', 'K', 'L'
4040
]
4141

@@ -147,4 +147,4 @@ def main():
147147

148148
if __name__ == '__main__':
149149
logging.basicConfig(format='%(asctime)s %(levelname)-8s %(message)s', level=logging.INFO)
150-
main()
150+
main()

java_package/brainflow/src/main/java/brainflow/BoardDescr.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public class BoardDescr
1010
public List<Integer> exg_channels;
1111
public List<Integer> emg_channels;
1212
public List<Integer> ppg_channels;
13+
public List<Integer> optical_channels;
1314
public List<Integer> eda_channels;
1415
public List<Integer> accel_channels;
1516
public List<Integer> rotation_channels;
@@ -33,6 +34,7 @@ public BoardDescr ()
3334
exg_channels = null;
3435
emg_channels = null;
3536
ppg_channels = null;
37+
optical_channels = null;
3638
eda_channels = null;
3739
accel_channels = null;
3840
rotation_channels = null;

0 commit comments

Comments
 (0)