Skip to content

Commit b159fe3

Browse files
neuropawn-adminKevin-Xue01aa217
authored
Add NeuroPawn Knight IMU Board Support and Gain Configuration (#795)
* Imu (#5) Co-authored-by: Kevin <kevinx1698@gmail.com> Co-authored-by: Kevin-Xue01 <59587075+Kevin-Xue01@users.noreply.github.com> Co-authored-by: aa217 <125326241+aa217@users.noreply.github.com> Co-authored-by: abdallah <abdallah.alwan2001@gmail.com> * Patch/pr 795 refactor (#7) * rename + boardId for all languages * removed gain from BrainFlowInputParams, format --------- Co-authored-by: Kevin <kevinx1698@gmail.com> Co-authored-by: Kevin-Xue01 <59587075+Kevin-Xue01@users.noreply.github.com> Co-authored-by: aa217 <125326241+aa217@users.noreply.github.com> Co-authored-by: abdallah <abdallah.alwan2001@gmail.com>
1 parent c3a28e2 commit b159fe3

File tree

17 files changed

+482
-255
lines changed

17 files changed

+482
-255
lines changed

csharp_package/brainflow/brainflow/board_controller_library.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@ public enum BoardIds
121121
SYNCHRONI_UNO_1_CHANNELS_BOARD = 62,
122122
OB3000_24_CHANNELS_BOARD = 63,
123123
BIOLISTENER_BOARD = 64,
124-
IRONBCI_32_BOARD = 65
124+
IRONBCI_32_BOARD = 65,
125+
NEUROPAWN_KNIGHT_BOARD_IMU = 66
125126
};
126127

127128

docs/SupportedBoards.rst

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1434,6 +1434,8 @@ Initialization Example:
14341434
14351435
params = BrainFlowInputParams()
14361436
params.serial_port = "COM3"
1437+
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
1438+
14371439
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD, params)
14381440
14391441
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**
@@ -1447,6 +1449,41 @@ Supported platforms:
14471449
- MacOS
14481450
- Devices like Raspberry Pi
14491451

1452+
Knight IMU Board
1453+
~~~~~~~~~~~~~~~~~
1454+
1455+
.. image:: https://live.staticflickr.com/65535/54061606098_e223ab04a6_w.jpg
1456+
:width: 400px
1457+
:height: 274px
1458+
1459+
`NeuroPawn website <https://www.neuropawn.tech/>`_
1460+
1461+
To create such board you need to specify the following board ID and fields of BrainFlowInputParams object:
1462+
1463+
- :code:`BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU`
1464+
- :code:`serial_port`, e.g. COM3, /dev/tty.*
1465+
1466+
Initialization Example:
1467+
1468+
.. code-block:: python
1469+
1470+
params = BrainFlowInputParams()
1471+
params.serial_port = "COM3"
1472+
params.other_info = '{"gain": 6}' # optional: set gain to allowed values: 1, 2, 3, 4, 6, 8, 12 (default)
1473+
1474+
board = BoardShim(BoardIds.NEUROPAWN_KNIGHT_BOARD_IMU, params)
1475+
1476+
**On Unix-like systems you may need to configure permissions for serial port or run with sudo.**
1477+
1478+
**On MacOS there are two serial ports for each device: /dev/tty..... and /dev/cu..... You HAVE to specify /dev/cu.....**
1479+
1480+
Supported platforms:
1481+
1482+
- Windows
1483+
- Linux
1484+
- MacOS
1485+
- Devices like Raspberry Pi
1486+
14501487

14511488
BioListener
14521489
--------

java_package/brainflow/src/main/java/brainflow/BoardIds.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@ public enum BoardIds
7171
SYNCHRONI_UNO_1_CHANNELS_BOARD(62),
7272
OB3000_24_CHANNELS_BOARD(63),
7373
BIOLISTENER_BOARD(64),
74-
IRONBCI_32_BOARD(65);
74+
IRONBCI_32_BOARD(65),
75+
NEUROPAWN_KNIGHT_BOARD_IMU(66);
7576

7677
private final int board_id;
7778
private static final Map<Integer, BoardIds> bi_map = new HashMap<Integer, BoardIds> ();

julia_package/brainflow/src/board_shim.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export BrainFlowInputParams
6767
OB3000_24_CHANNELS_BOARD = 63
6868
BIOLISTENER_BOARD = 64
6969
IRONBCI_32_BOARD = 65
70+
NEUROPAWN_KNIGHT_BOARD_IMU = 66
7071

7172
end
7273

matlab_package/brainflow/BoardIds.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,5 +65,6 @@
6565
OB3000_24_CHANNELS_BOARD(63)
6666
BIOLISTENER_BOARD(64)
6767
IRONBCI_32_BOARD(65)
68+
NEUROPAWN_KNIGHT_BOARD_IMU(66)
6869
end
6970
end

python_package/brainflow/board_shim.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class BoardIds(enum.IntEnum):
8080
OB3000_24_CHANNELS_BOARD = 63 #:
8181
BIOLISTENER_BOARD = 64 #:
8282
IRONBCI_32_BOARD = 65 #:
83+
NEUROPAWN_KNIGHT_BOARD_IMU = 66 #:
8384

8485

8586
class IpProtocolTypes(enum.IntEnum):

rust_package/brainflow/src/ffi/constants.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ impl BoardIds {
3232
pub const FIRST: BoardIds = BoardIds::PlaybackFileBoard;
3333
}
3434
impl BoardIds {
35-
pub const LAST: BoardIds = BoardIds::Ironbci32Board;
35+
pub const LAST: BoardIds = BoardIds::NeuropawnKnightBoardImu;
3636
}
3737
#[repr(i32)]
3838
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]
@@ -101,6 +101,7 @@ pub enum BoardIds {
101101
Ob300024ChannelsBoard = 63,
102102
BiolistenerBoard = 64,
103103
Ironbci32Board = 65,
104+
NeuropawnKnightBoardImu = 66,
104105
}
105106
#[repr(i32)]
106107
#[derive(FromPrimitive, ToPrimitive, Debug, Copy, Clone, Hash, PartialEq, Eq)]

src/board_controller/board_controller.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
#include "gforce_pro.h"
4646
#include "json.hpp"
4747
#include "knight.h"
48+
#include "knight_imu.h"
4849
#include "muse.h"
4950
#include "muse_bled.h"
5051
#include "notion_osc.h"
@@ -299,6 +300,10 @@ int prepare_session (int board_id, const char *json_brainflow_input_params)
299300
case BoardIds::BIOLISTENER_BOARD:
300301
board = std::shared_ptr<Board> (new BioListener<8> (board_id, params));
301302
break;
303+
case BoardIds::NEUROPAWN_KNIGHT_BOARD_IMU:
304+
board = std::shared_ptr<Board> (
305+
new KnightIMU ((int)BoardIds::NEUROPAWN_KNIGHT_BOARD_IMU, params));
306+
break;
302307
default:
303308
return (int)BrainFlowExitCodes::UNSUPPORTED_BOARD_ERROR;
304309
}

src/board_controller/brainflow_boards.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ BrainFlowBoards::BrainFlowBoards()
8484
{"63", json::object()},
8585
{"64", json::object()},
8686
{"65", json::object()},
87+
{"66", json::object()}
8788
}
8889
}};
8990

@@ -1147,6 +1148,17 @@ BrainFlowBoards::BrainFlowBoards()
11471148
{"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}},
11481149
{"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}}
11491150
};
1151+
brainflow_boards_json["boards"]["66"]["default"] =
1152+
{
1153+
{"name", "KnightIMU"},
1154+
{"sampling_rate", 125},
1155+
{"timestamp_channel", 20},
1156+
{"marker_channel", 21},
1157+
{"package_num_channel", 0},
1158+
{"num_rows", 22},
1159+
{"eeg_channels", {1, 2, 3, 4, 5, 6, 7, 8}},
1160+
{"other_channels", {9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}}
1161+
};
11501162
}
11511163

11521164
BrainFlowBoards boards_struct;

src/board_controller/build.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ SET (BOARD_CONTROLLER_SRC
8484
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/pieeg/pieeg_board.cpp
8585
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/synchroni/synchroni_board.cpp
8686
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight.cpp
87+
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight_base.cpp
88+
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/neuropawn/knight_imu.cpp
8789
${CMAKE_CURRENT_SOURCE_DIR}/src/board_controller/biolistener/biolistener.cpp
8890
)
8991

0 commit comments

Comments
 (0)