Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: bump simpleble and add syncroni device #746

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cppcheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
run: cppcheck-htmlreport --title=BrainFlow --file=cppcheck_res.xml --report-dir=report
- name: Upload Report
if: ${{ failure() }}
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: report
path: report
4 changes: 2 additions & 2 deletions .github/workflows/deploy_cpp_libs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:

# Start Deploy Stage
- name: Upload ${{ matrix.build_type }} ${{ matrix.arch }} with MSVC runtime ${{ matrix.msvc_runtime }}
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: compiled_libs
path: artifacts
Expand Down Expand Up @@ -104,7 +104,7 @@ jobs:
env:
BUILD: ${{ matrix.build_type }}
- name: Upload Artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: compiled_libs
path: artifacts
2 changes: 1 addition & 1 deletion .github/workflows/deploy_julia.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
env:
VERSION: ${{ github.event.inputs.version }}
- name: Upload Julia Diff
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: julia.patch
path: julia.patch
Expand Down
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
Loading