Skip to content

Commit

Permalink
Updates on adding Synchroni Devices (#754)
Browse files Browse the repository at this point in the history
* Synchroni Board setup incomplete

Signed-off-by: Andrey Parfenov <[email protected]>
Co-authored-by: Andrey Parfenov <[email protected]>
Co-authored-by: yecq <[email protected]>
  • Loading branch information
3 people authored Jan 28, 2025
1 parent f99dda1 commit 41a1d4a
Show file tree
Hide file tree
Showing 123 changed files with 5,884 additions and 17 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -379,4 +379,3 @@ Makefile
CMakeSettings.json
._.gitignore

build/
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required (VERSION 3.13)

project (brainflow)

SET (CMAKE_CXX_STANDARD 11)
Expand All @@ -20,6 +21,7 @@ option (USE_LIBFTDI "USE_LIBFTDI" OFF)
option (USE_OPENMP "USE_OPENMP" OFF)
option (WARNINGS_AS_ERRORS "WARNINGS_AS_ERRORS" OFF)
option (BUILD_OYMOTION_SDK "BUILD_OYMOTION_SDK" OFF)
option (BUILD_SYNCHRONI_SDK "BUILD_SYNCHRONI_SDK" ON)
option (BUILD_BLUETOOTH "BUILD_BLUETOOTH" OFF)
option (BUILD_BLE "BUILD_BLE" OFF)
option (BUILD_ONNX "BUILD_ONNX" OFF)
Expand Down Expand Up @@ -51,6 +53,8 @@ if (BUILD_TESTS)
include (${CMAKE_CURRENT_SOURCE_DIR}/src/tests/build.cmake)
endif (BUILD_TESTS)

#add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/cpp_package/examples/get_data)

include (CMakePackageConfigHelpers)

write_basic_package_version_file (
Expand All @@ -72,4 +76,4 @@ install (
EXPORT ${TARGETS_EXPORT_NAME}
NAMESPACE brainflow::
DESTINATION ${CONFIG_INSTALL_DIR}
)
)
9 changes: 7 additions & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ class BrainflowConan(ConanFile):
# Binary configuration
settings = "os", "compiler", "build_type", "arch"
options = {"libftdi": [True, False], "openmp": [True, False], "onnx": [True, False], "bluetooth": [True, False],
"ble": [True, False], "periphery": [True, False], "oymotion": [True, False],
"ble": [True, False], "periphery": [True, False], "oymotion": [True, False],"synchroni": [True, False],
"static_msvc_runtime": [True, False]}
default_options = {"libftdi": False, "openmp": False, "onnx": True, "bluetooth": True,
"ble": True, "periphery": False, "oymotion": False, "static_msvc_runtime": True}
"ble": True, "periphery": False, "oymotion": False,"synchroni": True, "static_msvc_runtime": True}

# Sources are located in the same place as this recipe, copy them to the recipe
exports_sources = "CMakeLists.txt", "src/*", "third_party/*", "cpp_package/build.cmake", "cpp_package/src/*", "cmake/*"
Expand All @@ -43,6 +43,11 @@ def build(self):
cmake.definitions["BUILD_BLUETOOTH"] = "ON"
if self.options.ble:
cmake.definitions["BUILD_BLE"] = "ON"
if self.options.synchroni:
if self.settings.os == "Android":
cmake.definitions["BUILD_SYNCHRONI_SDK"] = "OFF"
else:
cmake.definitions["BUILD_SYNCHRONI_SDK"] = "ON"
if self.settings.os != "Windows" and self.options.periphery:
cmake.definitions["USE_PERIPHERY"] = "ON"
if self.settings.os == "Windows" and self.options.oymotion:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,13 @@ public enum BoardIds
EXPLORE_PLUS_8_CHAN_BOARD = 54,
EXPLORE_PLUS_32_CHAN_BOARD = 55,
PIEEG_BOARD = 56,
NEUROPAWN_KNIGHT_BOARD = 57
NEUROPAWN_KNIGHT_BOARD = 57,
SYNCHRONI_TRIO_3_CHANNELS_BOARD = 58,
SYNCHRONI_OCTO_8_CHANNELS_BOARD = 59,
OB5000_8_CHANNELS_BOARD = 60,
SYNCHRONI_PENTO_8_CHANNELS_BOARD = 61,
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62,

};


Expand Down
8 changes: 7 additions & 1 deletion java_package/brainflow/src/main/java/brainflow/BoardIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,13 @@ public enum BoardIds
EXPLORE_PLUS_8_CHAN_BOARD(54),
EXPLORE_PLUS_32_CHAN_BOARD(55),
PIEEG_BOARD(56),
NEUROPAWN_KNIGHT_BOARD(57);
NEUROPAWN_KNIGHT_BOARD(57),
SYNCHRONI_TRIO_3_CHANNELS_BOARD(58),
SYNCHRONI_OCTO_8_CHANNELS_BOARD(59),
OB5000_8_CHANNELS_BOARD(60),
SYNCHRONI_PENTO_8_CHANNELS_BOARD(61),
SYNCHRONI_UNO_1_CHANNELS_BOARD(62);


private final int board_id;
private static final Map<Integer, BoardIds> bi_map = new HashMap<Integer, BoardIds> ();
Expand Down
8 changes: 8 additions & 0 deletions julia_package/brainflow/src/board_shim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,15 @@ export BrainFlowInputParams
EXPLORE_PLUS_8_CHAN_BOARD = 54
EXPLORE_PLUS_32_CHAN_BOARD = 55
PIEEG_BOARD = 56

NEUROPAWN_KNIGHT_BOARD = 57
SYNCHRONI_TRIO_3_CHANNELS_BOARD = 58
SYNCHRONI_OCTO_8_CHANNELS_BOARD = 59
OB5000_8_CHANNELS_BOARD = 60
SYNCHRONI_PENTO_8_CHANNELS_BOARD = 61
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62



end

Expand Down
7 changes: 7 additions & 0 deletions matlab_package/brainflow/BoardIds.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,13 @@
EXPLORE_PLUS_8_CHAN_BOARD(54)
EXPLORE_PLUS_32_CHAN_BOARD(55)
PIEEG_BOARD(56)

NEUROPAWN_KNIGHT_BOARD(57)
SYNCHRONI_TRIO_3_CHANNELS_BOARD(58)
SYNCHRONI_OCTO_8_CHANNELS_BOARD(59)
OB5000_8_CHANNELS_BOARD(60)
SYNCHRONI_PENTO_8_CHANNELS_BOARD(61)
SYNCHRONI_UNO_1_CHANNELS_BOARD(62)

end
end
10 changes: 8 additions & 2 deletions nodejs_package/brainflow/brainflow.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,15 @@ export enum BoardIds {
EXPLORE_PLUS_8_CHAN_BOARD = 54,
EXPLORE_PLUS_32_CHAN_BOARD = 55,
PIEEG_BOARD = 56,
NEUROPAWN_KNIGHT_BOARD = 57
}

NEUROPAWN_KNIGHT_BOARD = 57,
SYNCHRONI_TRIO_3_CHANNELS_BOARD = 58,
SYNCHRONI_OCTO_CHANNELS_BOARD = 59,
OB5000_8_CHANNELS_BOARD = 60,
SYNCHRONI_PENTO_8_CHANNELS_BOARD = 61,
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62

}
export enum IpProtocolTypes {
NO_IP_PROTOCOL = 0,
UDP = 1,
Expand Down
10 changes: 10 additions & 0 deletions python_package/brainflow/board_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,12 @@ class BoardIds(enum.IntEnum):
EXPLORE_PLUS_32_CHAN_BOARD = 55 #:
PIEEG_BOARD = 56 #:
NEUROPAWN_KNIGHT_BOARD = 57 #:
SYNCHRONI_TRIO_3_CHANNELS_BOARD = 58 #:
SYNCHRONI_OCTO_8_CHANNELS_BOARD = 59 #:
OB5000_8_CHANNELS_BOARD = 60 #:
SYNCHRONI_PENTO_8_CHANNELS_BOARD = 61 #:
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62 #:



class IpProtocolTypes(enum.IntEnum):
Expand Down Expand Up @@ -577,6 +583,10 @@ def __init__(self, board_id: int, input_params: BrainFlowInputParams) -> None:
else:
self._master_board_id = self.board_id

def __del__(self) -> None:
if self.is_prepared():
self.release_session()

@classmethod
def set_log_level(cls, log_level: int) -> None:
"""set BrainFlow log level, use it only if you want to write your own messages to BrainFlow logger,
Expand Down
1 change: 1 addition & 0 deletions python_package/examples/enophone/enophone_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def main():
params.mac_address = args.mac_address

try:
# board_shim = BoardShim(BoardIds.ENOPHONE_BOARD, params)
board_shim = BoardShim(BoardIds.ENOPHONE_BOARD, params)
board_shim.prepare_session()
board_shim.start_stream(450000, '')
Expand Down
2 changes: 1 addition & 1 deletion python_package/examples/tests/brainflow_get_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ def main():


if __name__ == "__main__":
main()
main()
9 changes: 9 additions & 0 deletions python_package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@
os.path.join('lib', 'gForceSDKWrapper.dll'),
os.path.join('lib', 'gforce64.dll'),
os.path.join('lib', 'gforce32.dll'),
os.path.join('lib', 'sensor.dll'),
os.path.join('lib', 'SynchroniLib.dll'),
os.path.join('lib', 'sensor32.dll'),
os.path.join('lib', 'SynchroniLib32.dll'),
os.path.join('lib', 'libsensor_x64.so'),
os.path.join('lib', 'libSynchroniLib_x64.so'),
os.path.join('lib', 'libsensor_arm64.so'),
os.path.join('lib', 'libSynchroniLib_arm64.so'),
os.path.join('lib', 'libneurosdk-shared.dylib'),
os.path.join('lib', 'libunicorn.so'),
os.path.join('lib', 'libunicorn_raspberry.so'),
Expand All @@ -62,6 +70,7 @@
os.path.join('lib', 'BrainFlowBluetooth32.dll'),
os.path.join('lib', 'libBrainFlowBluetooth.so'),
os.path.join('lib', 'libBrainFlowBluetooth.dylib'),
os.path.join('lib', 'libSynchroniLib.dylib'),
os.path.join('lib', 'simpleble-c.dll'),
os.path.join('lib', 'simpleble-c32.dll'),
os.path.join('lib', 'libsimpleble-c.so'),
Expand Down
5 changes: 5 additions & 0 deletions rust_package/brainflow/src/ffi/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ pub enum BoardIds {
ExplorePlus32ChanBoard = 55,
PieegBoard = 56,
NeuropawnKnightBoard = 57,
SynchroniTrio3ChannelsBoard = 58,
SynchroniOcto8ChannelsBoard = 59,
OB50008CHannelsBoard= 60 ,
SynchroniPento8ChannelsBoard = 61,
SynchroniUno1ChannelsBoard = 62
}
#[repr(i32)]
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down
19 changes: 19 additions & 0 deletions src/board_controller/board_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "pieeg_board.h"
#include "playback_file_board.h"
#include "streaming_board.h"
#include "synchroni_board.h"
#include "synthetic_board.h"
#include "unicorn_board.h"

Expand Down Expand Up @@ -281,6 +282,24 @@ int prepare_session (int board_id, const char *json_brainflow_input_params)
case BoardIds::PIEEG_BOARD:
board = std::shared_ptr<Board> (new PIEEGBoard (board_id, params));
break;
case BoardIds::SYNCHRONI_TRIO_3_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::SYNCHRONI_OCTO_8_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::SYNCHRONI_NEO_8_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::SYNCHRONI_UNO_1_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::OB5000_8_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::OB3000_24_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::NEUROPAWN_KNIGHT_BOARD:
board =
std::shared_ptr<Board> (new Knight ((int)BoardIds::NEUROPAWN_KNIGHT_BOARD, params));
Expand Down
65 changes: 64 additions & 1 deletion src/board_controller/brainflow_boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ BrainFlowBoards::BrainFlowBoards()
{"54", json::object()},
{"55", json::object()},
{"56", json::object()},
{"57", json::object()}
{"57", json::object()},
{"58", json::object()},
{"59", json::object()},
{"60", json::object()},
{"61", json::object()},
{"62", json::object()}

}
}};

Expand Down Expand Up @@ -1128,6 +1134,63 @@ BrainFlowBoards::BrainFlowBoards()
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}},
{"other_channels", {9, 10}}
};
brainflow_boards_json["boards"]["58"]["default"] = {
{"name", "Sync-Trio"},
{"sampling_rate", 250},
{"package_num_channel", 0},
{"timestamp_channel", 4},
{"marker_channel", 5},
{"num_rows", 6},
{"eeg_channels", {1, 2}},
{"ecg_channels", {3}}
};
brainflow_boards_json["boards"]["59"]["default"] = {
{"name", "Sync-Octo"},
{"sampling_rate", 250},
{"package_num_channel", 0},
{"timestamp_channel", 9},
{"marker_channel", 10},
{"num_rows", 11},
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7}},
{"ecg_channels", {8}}
};
brainflow_boards_json["boards"]["60"]["default"] = {
{"name", "OB5000MAX"},
{"sampling_rate", 250},
{"package_num_channel", 0},
{"timestamp_channel", 9},
{"marker_channel", 10},
{"num_rows", 11},
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}},
};
brainflow_boards_json["boards"]["61"]["default"] = {
{"name", "Sync-Neo"},
{"sampling_rate", 250},
{"package_num_channel", 0},
{"timestamp_channel", 9},
{"marker_channel", 10},
{"num_rows", 11},
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}}
};
brainflow_boards_json["boards"]["62"]["default"] = {
{"name", "Sync-Uno"},
{"sampling_rate", 250},
{"package_num_channel", 0},
{"timestamp_channel", 2},
{"marker_channel", 3},
{"num_rows", 4},
{"eeg_channels", {1}}
};
brainflow_boards_json["boards"]["63"]["default"] = {
{"name", "OB3000"},
{"sampling_rate", 500},
{"package_num_channel", 0},
{"timestamp_channel", 25},
{"marker_channel", 26},
{"num_rows", 27},
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23}},
{"ecg_channels", {24}}
};
}

BrainFlowBoards boards_struct;
17 changes: 11 additions & 6 deletions src/board_controller/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ SET (BOARD_CONTROLLER_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/ntl/ntl_wifi.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/aavaa/aavaa_v3.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/pieeg/pieeg_board.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/synchroni/synchroni_board.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight.cpp
)

Expand All @@ -98,6 +99,14 @@ if (BUILD_OYMOTION_SDK)
include (${CMAKE_CURRENT_SOURCE_DIR}/third_party/gForceSDKCXX/build.cmake)
endif (BUILD_OYMOTION_SDK)

if (BUILD_SYNCHRONI_SDK)
if (ANDROID)

else ()
include (${CMAKE_CURRENT_SOURCE_DIR}/third_party/synchroni/build.cmake)
endif ()
endif (BUILD_SYNCHRONI_SDK)

if (BUILD_BLUETOOTH)
include (${CMAKE_CURRENT_SOURCE_DIR}/src/utils/bluetooth/build.cmake)
endif (BUILD_BLUETOOTH)
Expand All @@ -111,11 +120,6 @@ add_library (
${BOARD_CONTROLLER_SRC}
)

#if (ANDROID AND BUILD_BLE)
# target_compile_definitions (${BOARD_CONTROLLER_NAME} PRIVATE STATIC_SIMPLEBLE)
# target_link_libraries (${BOARD_CONTROLLER_NAME} PRIVATE simpleble-c)
#endif (ANDROID AND BUILD_BLE)

target_include_directories (
${BOARD_CONTROLLER_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/third_party/
Expand Down Expand Up @@ -148,6 +152,7 @@ target_include_directories (
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/ntl/inc
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/aavaa/inc
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/pieeg/inc
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/synchroni/inc
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/inc
)

Expand Down Expand Up @@ -208,7 +213,7 @@ if (UNIX AND NOT ANDROID)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/python_package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/julia_package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/java_package/brainflow/src/main/resources/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/compiled/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_CURRENT_SOURCE_DIR}/csharp_package/brainflow/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/inc/board_controller.h" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/inc/board_controller.h"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/inc/board_info_getter.h" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/inc/board_info_getter.h"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/src/utils/inc/shared_export_matlab.h" "${CMAKE_CURRENT_SOURCE_DIR}/matlab_package/brainflow/inc/shared_export.h"
Expand Down
Loading

0 comments on commit 41a1d4a

Please sign in to comment.