Skip to content

Commit

Permalink
wip: bump simpleble and add syncroni device
Browse files Browse the repository at this point in the history
Signed-off-by: Andrey Parfenov <[email protected]>
  • Loading branch information
Andrey1994 committed Sep 15, 2024
1 parent 6118510 commit fb080bd
Show file tree
Hide file tree
Showing 265 changed files with 15,001 additions and 1,403 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ public enum BoardIds
AAVAA_V3_BOARD = 53,
EXPLORE_PLUS_8_CHAN_BOARD = 54,
EXPLORE_PLUS_32_CHAN_BOARD = 55,
PIEEG_BOARD = 56
PIEEG_BOARD = 56,
SYNCHRONI_3_CHANNELS_BOARD = 57,
SYNCHRONI_8_CHANNELS_BOARD = 58
};


Expand Down
4 changes: 3 additions & 1 deletion java_package/brainflow/src/main/java/brainflow/BoardIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ public enum BoardIds
AAVAA_V3_BOARD(53),
EXPLORE_PLUS_8_CHAN_BOARD(54),
EXPLORE_PLUS_32_CHAN_BOARD(55),
PIEEG_BOARD(56);
PIEEG_BOARD(56),
SYNCHRONI_3_CHANNELS_BOARD(57),
SYNCHRONI_8_CHANNELS_BOARD(58);

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

end

Expand Down
2 changes: 2 additions & 0 deletions matlab_package/brainflow/BoardIds.m
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@
EXPLORE_PLUS_8_CHAN_BOARD(54)
EXPLORE_PLUS_32_CHAN_BOARD(55)
PIEEG_BOARD(56)
SYNCHRONI_3_CHANNELS_BOARD(57)
SYNCHRONI_8_CHANNELS_BOARD(58)
end
end
4 changes: 3 additions & 1 deletion nodejs_package/brainflow/brainflow.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ export enum BoardIds {
ANT_NEURO_EE_511_BOARD = 51,
EXPLORE_PLUS_8_CHAN_BOARD = 54,
EXPLORE_PLUS_32_CHAN_BOARD = 55,
PIEEG_BOARD = 56
PIEEG_BOARD = 56,
SYNCHRONI_3_CHANNELS_BOARD = 57,
SYNCHRONI_8_CHANNELS_BOARD = 58
}

export enum IpProtocolTypes {
Expand Down
2 changes: 2 additions & 0 deletions python_package/brainflow/board_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class BoardIds(enum.IntEnum):
EXPLORE_PLUS_8_CHAN_BOARD = 54 #:
EXPLORE_PLUS_32_CHAN_BOARD = 55 #:
PIEEG_BOARD = 56 #:
SYNCHRONI_3_CHANNELS_BOARD = 57 #:
SYNCHRONI_8_CHANNELS_BOARD = 58 #:


class IpProtocolTypes(enum.IntEnum):
Expand Down
7 changes: 7 additions & 0 deletions src/board_controller/board_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,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,12 @@ 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_3_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
case BoardIds::SYNCHRONI_8_CHANNELS_BOARD:
board = std::shared_ptr<Board> (new SynchroniBoard (board_id, params));
break;
default:
return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR;
}
Expand Down
25 changes: 24 additions & 1 deletion src/board_controller/brainflow_boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ BrainFlowBoards::BrainFlowBoards()
{"53", json::object()},
{"54", json::object()},
{"55", json::object()},
{"56", json::object()}
{"56", json::object()},
{"57", json::object()},
{"58", json::object()}
}
}};

Expand Down Expand Up @@ -1095,6 +1097,27 @@ BrainFlowBoards::BrainFlowBoards()
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}},
{"eeg_names", "Fp1,Fp2,C3,C4,P7,P8,O1,O2"}
};
// TODO update:
brainflow_boards_json["boards"]["57"]["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"]["58"]["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}}
};
}

BrainFlowBoards boards_struct;
2 changes: 2 additions & 0 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
)

include (${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/ant_neuro/build.cmake)
Expand Down Expand Up @@ -142,6 +143,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
)

target_compile_definitions(${BOARD_CONTROLLER_NAME} PRIVATE NOMINMAX BRAINFLOW_VERSION=${BRAINFLOW_VERSION})
Expand Down
36 changes: 36 additions & 0 deletions src/board_controller/synchroni/inc/synchroni_board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#include <condition_variable>
#include <mutex>
#include <thread>

#include "ble_lib_board.h"
#include "board.h"
#include "board_controller.h"

class SynchroniBoard : public BLELibBoard
{

public:
SynchroniBoard (int board_id, struct BrainFlowInputParams params);
~SynchroniBoard ();

int prepare_session ();
int start_stream (int buffer_size, const char *streamer_params);
int stop_stream ();
int release_session ();
int config_board (std::string config, std::string &response);
int config_board (std::string config);

void adapter_1_on_scan_updated (simpleble_adapter_t adapter, simpleble_peripheral_t peripheral);
void read_data (
simpleble_uuid_t service, simpleble_uuid_t characteristic, uint8_t *data, size_t size);

protected:
volatile simpleble_adapter_t synchroni_board_adapter;
volatile simpleble_peripheral_t synchroni_board_peripheral;
bool initialized;
bool is_streaming;
std::mutex m;
std::condition_variable cv;
std::pair<simpleble_uuid_t, simpleble_uuid_t> notified_characteristics;
std::pair<simpleble_uuid_t, simpleble_uuid_t> write_characteristics;
};
Loading

0 comments on commit fb080bd

Please sign in to comment.