Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public enum BoardIds
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62,
OB3000_24_CHANNELS_BOARD = 63,
BIOLISTENER_BOARD = 64,
MUSE_S_ANTHENA_BOARD = 65
};


Expand Down
3 changes: 2 additions & 1 deletion java_package/brainflow/src/main/java/brainflow/BoardIds.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ public enum BoardIds
SYNCHRONI_PENTO_8_CHANNELS_BOARD(61),
SYNCHRONI_UNO_1_CHANNELS_BOARD(62),
OB3000_24_CHANNELS_BOARD(63),
BIOLISTENER_BOARD(64);
BIOLISTENER_BOARD(64),
MUSE_S_ANTHENA_BOARD(65);

private final int board_id;
private static final Map<Integer, BoardIds> bi_map = new HashMap<Integer, BoardIds> ();
Expand Down
1 change: 1 addition & 0 deletions julia_package/brainflow/src/board_shim.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export BrainFlowInputParams
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62
OB3000_24_CHANNELS_BOARD = 63
BIOLISTENER_BOARD = 64
MUSE_S_ANTHENA_BOARD = 65

end

Expand Down
1 change: 1 addition & 0 deletions matlab_package/brainflow/BoardIds.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@
SYNCHRONI_UNO_1_CHANNELS_BOARD(62)
OB3000_24_CHANNELS_BOARD(63)
BIOLISTENER_BOARD(64)
MUSE_S_ANTHENA_BOARD(65)
end
end
3 changes: 2 additions & 1 deletion nodejs_package/brainflow/brainflow.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ export enum BoardIds {
SYNCHRONI_PENTO_8_CHANNELS_BOARD = 61,
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62,
OB3000_24_CHANNELS_BOARD = 63,
BIOLISTENER_BOARD = 64
BIOLISTENER_BOARD = 64,
MUSE_S_ANTHENA_BOARD = 65
}

export enum IpProtocolTypes {
Expand Down
1 change: 1 addition & 0 deletions python_package/brainflow/board_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class BoardIds(enum.IntEnum):
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62 #:
OB3000_24_CHANNELS_BOARD = 63 #:
BIOLISTENER_BOARD = 64 #:
MUSE_S_ANTHENA_BOARD = 65 #:


class IpProtocolTypes(enum.IntEnum):
Expand Down
4 changes: 4 additions & 0 deletions src/board_controller/board_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
#include "json.hpp"
#include "knight.h"
#include "muse.h"
#include "muse_anthena.h"
#include "muse_bled.h"
#include "notion_osc.h"
#include "ntl_wifi.h"
Expand Down Expand Up @@ -237,6 +238,9 @@ int prepare_session (int board_id, const char *json_brainflow_input_params)
case BoardIds::MUSE_S_BOARD:
board = std::shared_ptr<Board> (new Muse (board_id, params));
break;
case BoardIds::MUSE_S_ANTHENA_BOARD:
board = std::shared_ptr<Board> (new MuseAnthena (board_id, params));
break;
case BoardIds::BRAINALIVE_BOARD:
board = std::shared_ptr<Board> (new BrainAlive (params));
break;
Expand Down
26 changes: 25 additions & 1 deletion src/board_controller/brainflow_boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ BrainFlowBoards::BrainFlowBoards()
{"61", json::object()},
{"62", json::object()},
{"63", json::object()},
{"64", json::object()}
{"64", json::object()},
{"65", json::object()}
}
}};

Expand Down Expand Up @@ -1221,6 +1222,29 @@ BrainFlowBoards::BrainFlowBoards()
{"battery_channel", 8},
{"other_channels", {9, 10}}
};
brainflow_boards_json["boards"]["65"]["default"] =
{
{"name", "MuseAnthena"},
{"sampling_rate", 256},
{"timestamp_channel", 6},
{"marker_channel", 7},
{"package_num_channel", 0},
{"num_rows", 8},
{"eeg_channels", {1, 2, 3, 4}},
{"eeg_names", "TP9,AF7,AF8,TP10"},
{"other_channels", {5}}
};
brainflow_boards_json["boards"]["65"]["auxiliary"] =
{
{"name", "MuseAnthenaAux"},
{"sampling_rate", 52},
{"timestamp_channel", 7},
{"marker_channel", 8},
{"package_num_channel", 0},
{"num_rows", 9},
{"accel_channels", {1, 2, 3}},
{"gyro_channels", {4, 5, 6}}
};
}

BrainFlowBoards boards_struct;
1 change: 1 addition & 0 deletions src/board_controller/build.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ SET (BOARD_CONTROLLER_SRC
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/enophone/enophone.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/ble_lib_board.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/muse/muse.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/muse/muse_anthena.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/brainalive/brainalive.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/emotibit/emotibit.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/ntl/ntl_wifi.cpp
Expand Down
44 changes: 44 additions & 0 deletions src/board_controller/muse/inc/muse_anthena.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#pragma once

#include <condition_variable>
#include <mutex>
#include <utility>
#include <vector>

#include "ble_lib_board.h"


class MuseAnthena : public BLELibBoard
{

protected:
volatile simpleble_adapter_t muse_adapter;
volatile simpleble_peripheral_t muse_peripheral;
bool initialized;
bool is_streaming;
std::mutex m;
std::condition_variable cv;
std::vector<std::pair<simpleble_uuid_t, simpleble_uuid_t>> notified_characteristics;
std::pair<simpleble_uuid_t, simpleble_uuid_t> control_characteristics;

std::string bytes_to_string (const uint8_t *data, size_t size);

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

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_on_scan_found (simpleble_adapter_t adapter, simpleble_peripheral_t peripheral);
void peripheral_on_eeg (simpleble_peripheral_t peripheral, simpleble_uuid_t service,
simpleble_uuid_t characteristic, const uint8_t *data, size_t size);
void peripheral_on_aux (simpleble_peripheral_t peripheral, simpleble_uuid_t service,
simpleble_uuid_t characteristic, const uint8_t *data, size_t size);
void peripheral_on_status (simpleble_peripheral_t peripheral, simpleble_uuid_t service,
simpleble_uuid_t characteristic, const uint8_t *data, size_t size);
};
13 changes: 13 additions & 0 deletions src/board_controller/muse/inc/muse_anthena_constants.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once


// info about services and chars
#define MUSE_ANTHENA_SERVICE_UUID 0xFE8D

#define MUSE_ANTHENA_GATT_ATTR_STREAM_TOGGLE "273e0001-4c4d-454d-96be-f03bac821358"
#define MUSE_ANTHENA_GATT_EEG "273e0013-4c4d-454d-96be-f03bac821358"
#define MUSE_ANTHENA_GATT_AUX "273e0014-4c4d-454d-96be-f03bac821358"

// info for equations
#define MUSE_ANTHENA_ACCELEROMETER_SCALE_FACTOR 0.0000610352
#define MUSE_ANTHENA_GYRO_SCALE_FACTOR 0.007476
8 changes: 7 additions & 1 deletion src/board_controller/muse/muse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -558,8 +558,14 @@ int Muse::config_board (std::string config)
{
return (int)BrainFlowExitCodes::BOARD_NOT_CREATED_ERROR;
}
uint8_t command[16];
constexpr int max_size = 16;
uint8_t command[max_size];
size_t len = config.size ();
if (len + 2 >= max_size)
{
safe_logger (spdlog::level::err, "Invalid command, max size is {}", max_size);
return (int)BrainFlowExitCodes::INVALID_ARGUMENTS_ERROR;
}
command[0] = (uint8_t)len + 1;
for (size_t i = 0; i < len; i++)
{
Expand Down
Loading
Loading