Skip to content
Open
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 @@ -121,7 +121,8 @@ public enum BoardIds
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62,
OB3000_24_CHANNELS_BOARD = 63,
BIOLISTENER_BOARD = 64,
IRONBCI_32_BOARD = 65
IRONBCI_32_BOARD = 65,
NEUROPAWN_KNIGHT_BOARD_IMU = 66
};


Expand Down
37 changes: 37 additions & 0 deletions docs/SupportedBoards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,8 @@ Initialization Example:
params = BrainFlowInputParams()
params.serial_port = "COM3"
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD, params)
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**
Expand All @@ -1447,6 +1449,41 @@ Supported platforms:
- MacOS
- Devices like Raspberry Pi

Knight IMU Board
~~~~~~~~~~~~~~~~~

.. image:: https://live.staticflickr.com/65535/54061606098_e223ab04a6_w.jpg
:width: 400px
:height: 274px

`NeuroPawn website <https://www.neuropawn.tech/>`_

To create such board you need to specify the following board ID and fields of BrainFlowInputParams object:

- :code:`BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU`
- :code:`serial_port`, e.g. COM3, /dev/tty.*

Initialization Example:

.. code-block:: python
params = BrainFlowInputParams()
params.serial_port = "COM3"
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU, params)
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**

**On MacOS there are two serial ports for each device: /dev/tty..... and /dev/cu..... You HAVE to specify /dev/cu.....**

Supported platforms:

- Windows
- Linux
- MacOS
- Devices like Raspberry Pi


BioListener
--------
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 @@ -71,7 +71,8 @@ public enum BoardIds
SYNCHRONI_UNO_1_CHANNELS_BOARD(62),
OB3000_24_CHANNELS_BOARD(63),
BIOLISTENER_BOARD(64),
IRONBCI_32_BOARD(65);
IRONBCI_32_BOARD(65),
NEUROPAWN_KNIGHT_BOARD_IMU(66);

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 @@ -67,6 +67,7 @@ export BrainFlowInputParams
OB3000_24_CHANNELS_BOARD = 63
BIOLISTENER_BOARD = 64
IRONBCI_32_BOARD = 65
NEUROPAWN_KNIGHT_BOARD_IMU = 66

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 @@ -65,5 +65,6 @@
OB3000_24_CHANNELS_BOARD(63)
BIOLISTENER_BOARD(64)
IRONBCI_32_BOARD(65)
NEUROPAWN_KNIGHT_BOARD_IMU(66)
end
end
1 change: 1 addition & 0 deletions python_package/brainflow/board_shim.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class BoardIds(enum.IntEnum):
OB3000_24_CHANNELS_BOARD = 63 #:
BIOLISTENER_BOARD = 64 #:
IRONBCI_32_BOARD = 65 #:
NEUROPAWN_KNIGHT_BOARD_IMU = 66 #:


class IpProtocolTypes(enum.IntEnum):
Expand Down
3 changes: 2 additions & 1 deletion rust_package/brainflow/src/ffi/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl BoardIds {
pub const FIRST: BoardIds = BoardIds::PlaybackFileBoard;
}
impl BoardIds {
pub const LAST: BoardIds = BoardIds::Ironbci32Board;
pub const LAST: BoardIds = BoardIds::NeuropawnKnightBoardImu;
}
#[repr(i32)]
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down Expand Up @@ -101,6 +101,7 @@ pub enum BoardIds {
Ob300024ChannelsBoard = 63,
BiolistenerBoard = 64,
Ironbci32Board = 65,
NeuropawnKnightBoardImu = 66,
}
#[repr(i32)]
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]
Expand Down
5 changes: 5 additions & 0 deletions src/board_controller/board_controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "gforce_pro.h"
#include "json.hpp"
#include "knight.h"
#include "knight_imu.h"
#include "muse.h"
#include "muse_bled.h"
#include "notion_osc.h"
Expand Down Expand Up @@ -299,6 +300,10 @@ int prepare_session (int board_id, const char *json_brainflow_input_params)
case BoardIds::BIOLISTENER_BOARD:
board = std::shared_ptr<Board> (new BioListener<8> (board_id, params));
break;
case BoardIds::NEUROPAWN_KNIGHT_BOARD_IMU:
board = std::shared_ptr<Board> (
new KnightIMU ((int)BoardIds::NEUROPAWN_KNIGHT_BOARD_IMU, params));
break;
default:
return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR;
}
Expand Down
12 changes: 12 additions & 0 deletions src/board_controller/brainflow_boards.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ BrainFlowBoards::BrainFlowBoards()
{"63", json::object()},
{"64", json::object()},
{"65", json::object()},
{"66", json::object()}
}
}};

Expand Down Expand Up @@ -1147,6 +1148,17 @@ BrainFlowBoards::BrainFlowBoards()
{"emg_channels", {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}},
{"ecg_channels", {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32}}
};
brainflow_boards_json["boards"]["66"]["default"] =
{
{"name", "KnightIMU"},
{"sampling_rate", 125},
{"timestamp_channel", 20},
{"marker_channel", 21},
{"package_num_channel", 0},
{"num_rows", 22},
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}},
{"other_channels", {9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}}
};
}

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 @@ -84,6 +84,8 @@ SET (BOARD_CONTROLLER_SRC
${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
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight_base.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight_imu.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/biolistener/biolistener.cpp
)

Expand Down
31 changes: 2 additions & 29 deletions src/board_controller/neuropawn/inc/knight.h
Original file line number Diff line number Diff line change
@@ -1,40 +1,13 @@
#pragma once

#include <thread>
#include "knight_base.h"

#include "board.h"
#include "board_controller.h"
#include "serial.h"

class Knight : public Board
class Knight : public KnightBase
{

protected:
volatile bool keep_alive;
bool initialized;
bool is_streaming;
std::thread streaming_thread;
Serial *serial;

int min_package_size;

virtual int send_to_board (const char *msg);
virtual int send_to_board (const char *msg, std::string &response);
virtual std::string read_serial_response ();
int open_port ();
int set_port_settings ();
void read_thread ();

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

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);

static constexpr int start_byte = 0xA0;
static constexpr int end_byte = 0xC0;
};
45 changes: 45 additions & 0 deletions src/board_controller/neuropawn/inc/knight_base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
#pragma once

#include <set>
#include <thread>

#include "board.h"
#include "board_controller.h"
#include "serial.h"

class KnightBase : public Board
{

protected:
volatile bool keep_alive;
bool initialized;
bool is_streaming;
std::thread streaming_thread;
Serial *serial;

int min_package_size;
int gain;

virtual int send_to_board (const char *msg);
virtual int send_to_board (const char *msg, std::string &response);
virtual std::string read_serial_response ();
virtual int open_port ();
virtual int set_port_settings ();
virtual void read_thread () = 0;

private:
static const std::set<int> allowed_gains;

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

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

static constexpr int start_byte = 0xA0;
static constexpr int end_byte = 0xC0;
};
13 changes: 13 additions & 0 deletions src/board_controller/neuropawn/inc/knight_imu.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#pragma once

#include "knight_base.h"

class KnightIMU : public KnightBase
{

protected:
void read_thread ();

public:
KnightIMU (int board_id, struct BrainFlowInputParams params);
};
Loading