Skip to content

Commit

Permalink
Merge remote-tracking branch 'openbci/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrey1994 committed Mar 2, 2020
2 parents dca2b12 + 14bf230 commit c5d9555
Show file tree
Hide file tree
Showing 64 changed files with 2,310 additions and 174 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ addons:

install:
- sudo pip3 install --upgrade pip
- sudo pip3 install cmake==3.13.0
- sudo pip3 install cmake==3.13.3
- sudo -H pip3 install --upgrade setuptools wheel virtualenv
- sudo -H pip3 install $TRAVIS_BUILD_DIR/emulator
# R disabled. It's taking up too much time in CI
Expand All @@ -55,7 +55,7 @@ before_script:
cd $TRAVIS_BUILD_DIR && mkdir build_outside && cd build_outside && cmake -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/installed -DCMAKE_BUILD_TYPE=Release .. && sudo -H make && make install;
fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then
docker run -e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR -v $TRAVIS_BUILD_DIR:$TRAVIS_BUILD_DIR dockcross/manylinux-x64 /bin/bash -c "/opt/python/cp36-cp36m/bin/pip3.6 install cmake==3.13.0 && cd $TRAVIS_BUILD_DIR && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/installed_docker -DCMAKE_BUILD_TYPE=Release .. && make && make install" ;
docker run -e TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR -v $TRAVIS_BUILD_DIR:$TRAVIS_BUILD_DIR dockcross/manylinux-x64 /bin/bash -c "/opt/python/cp36-cp36m/bin/pip3.6 install cmake==3.13.3 && cd $TRAVIS_BUILD_DIR && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$TRAVIS_BUILD_DIR/installed_docker -DCMAKE_BUILD_TYPE=Release .. && make && make install" ;
fi
# build for mac
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then
Expand Down
36 changes: 32 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ if (CMAKE_SIZEOF_VOID_P EQUAL 8)
else ()
SET (BOARD_CONTROLLER_COMPILED_NAME "BoardController.dll")
SET (DATA_HANDLER_COMPILED_NAME "DataHandler.dll")
SET (BRIANBIT_LIB_NAME "neurosdk-x64")
endif (APPLE)
else (CMAKE_SIZEOF_VOID_P EQUAL 8)
MESSAGE ("32 bits compiler detected")
Expand All @@ -113,6 +114,7 @@ else (CMAKE_SIZEOF_VOID_P EQUAL 8)
else ()
SET (BOARD_CONTROLLER_COMPILED_NAME "BoardController32.dll")
SET (DATA_HANDLER_COMPILED_NAME "DataHandler32.dll")
SET (BRIANBIT_LIB_NAME "neurosdk-x86")
endif (APPLE)
endif (CMAKE_SIZEOF_VOID_P EQUAL 8)

Expand Down Expand Up @@ -140,6 +142,7 @@ set (BOARD_CONTROLLER_SRC
${CMAKE_HOME_DIRECTORY}/src/board_controller/openbci/novaxr.cpp
${CMAKE_HOME_DIRECTORY}/src/board_controller/file_streamer.cpp
${CMAKE_HOME_DIRECTORY}/src/board_controller/multicast_streamer.cpp
${CMAKE_HOME_DIRECTORY}/src/board_controller/brainbit/brainbit.cpp
)

set (DATA_HANDLER_SRC
Expand All @@ -164,9 +167,22 @@ target_include_directories (
${CMAKE_HOME_DIRECTORY}/src/utils/inc
${CMAKE_HOME_DIRECTORY}/src/board_controller/inc
${CMAKE_HOME_DIRECTORY}/src/board_controller/openbci/inc
${CMAKE_HOME_DIRECTORY}/src/board_controller/brainbit/inc
${CMAKE_HOME_DIRECTORY}/src/board_controller/openbci/ganglion_bglib/inc
)

# BrainBit supoprts only Windows
if (MSVC)
target_include_directories (
${BOARD_CONTROLLER_NAME} PRIVATE
${CMAKE_HOME_DIRECTORY}/third_party/brainbit/inc
)

find_library(BRAINBIT_SDK_LIB NAMES ${BRIANBIT_LIB_NAME} PATHS ${CMAKE_HOME_DIRECTORY}/third_party/brainbit/lib)
target_link_libraries(${BOARD_CONTROLLER_NAME} PRIVATE ${BRAINBIT_SDK_LIB})

endif (MSVC)

target_include_directories (
${DATA_HANDLER_NAME} PRIVATE
${CMAKE_HOME_DIRECTORY}/third_party/
Expand All @@ -193,11 +209,11 @@ set_target_properties (${DATA_HANDLER_NAME}
)

if (UNIX)
target_link_libraries (${BOARD_CONTROLLER_NAME} ${GANGLION_LIB} pthread dl)
target_link_libraries (${DATA_HANDLER_NAME} ${DSPFILTERS} ${WAVELIB} pthread dl)
target_link_libraries (${BOARD_CONTROLLER_NAME} PRIVATE ${GANGLION_LIB} pthread dl)
target_link_libraries (${DATA_HANDLER_NAME} PRIVATE ${DSPFILTERS} ${WAVELIB} pthread dl)
else (UNIX)
target_link_libraries (${BOARD_CONTROLLER_NAME} ${GANGLION_LIB})
target_link_libraries (${DATA_HANDLER_NAME} ${DSPFILTERS} ${WAVELIB})
target_link_libraries (${BOARD_CONTROLLER_NAME} PRIVATE ${GANGLION_LIB})
target_link_libraries (${DATA_HANDLER_NAME} PRIVATE ${DSPFILTERS} ${WAVELIB})
endif (UNIX)

add_library (
Expand Down Expand Up @@ -227,6 +243,9 @@ if (MSVC)
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/compiled/$<CONFIG>/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_HOME_DIRECTORY}/python-package/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/compiled/$<CONFIG>/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_HOME_DIRECTORY}/java-package/brainflow/src/main/resources/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/compiled/$<CONFIG>/${BOARD_CONTROLLER_COMPILED_NAME}" "${CMAKE_HOME_DIRECTORY}/csharp-package/brainflow/brainflow/lib/${BOARD_CONTROLLER_COMPILED_NAME}"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/third_party/brainbit/lib/${BRIANBIT_LIB_NAME}.dll" "${CMAKE_HOME_DIRECTORY}/csharp-package/brainflow/brainflow/lib/${BRIANBIT_LIB_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/third_party/brainbit/lib/${BRIANBIT_LIB_NAME}.dll" "${CMAKE_HOME_DIRECTORY}/python-package/brainflow/lib/${BRIANBIT_LIB_NAME}.dll"
COMMAND "${CMAKE_COMMAND}" -E copy_if_different "${CMAKE_HOME_DIRECTORY}/third_party/brainbit/lib/${BRIANBIT_LIB_NAME}.dll" "${CMAKE_HOME_DIRECTORY}/java-package/brainflow/src/main/resources/${BRIANBIT_LIB_NAME}.dll"
)
add_custom_command (TARGET ${DATA_HANDLER_NAME} POST_BUILD
# copy data handler libs
Expand Down Expand Up @@ -291,6 +310,15 @@ install (
DESTINATION inc
)

# install brainbit dll
if (MSVC)
install (
FILES
${CMAKE_HOME_DIRECTORY}/third_party/brainbit/lib/${BRIANBIT_LIB_NAME}.dll
DESTINATION lib
)
endif (MSVC)

# need to put this file with libraries
install (
FILES
Expand Down
10 changes: 10 additions & 0 deletions brainflow_boards.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,16 @@
"accel_channels" : [17, 18, 19],
"analog_channels" : [27, 28, 29],
"other_channels": [20, 21, 22, 23, 24, 25, 26]
},
"7" : {
"name": "BrainBit",
"sampling_rate": 250,
"timestamp_channel" : 10,
"package_num_channel": 0,
"battery_channel": 9,
"num_rows" : 11,
"eeg_channels" : [1, 2, 3, 4],
"other_channels": [5, 6, 7, 8]
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,10 @@ public enum BoardIds
GANGLION_BOARD = 1,
CYTON_DAISY_BOARD = 2,
NOVAXR_BOARD = 3,
GANGLION_WIFI = 4,
CYTON_WIFI = 5,
CYTON_DAISY_WIFI = 6
GANGLION_WIFI_BOARD = 4,
CYTON_WIFI_BOARD = 5,
CYTON_DAISY_WIFI_BOARD = 6,
BRAINBIT_BOARD = 7
};


Expand Down
8 changes: 4 additions & 4 deletions docs/BuildBrainFlow.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,15 @@ Compilation of Core module and C++ binding
Windows
~~~~~~~~

- Install Cmake>=3.10 you can install it from PYPI via pip
- Install Cmake>=3.13 you can install it from PYPI via pip
- Install Visual Studio 2017, you can use another version but you will need to change cmake generator in batch files or run cmake commands manually. Also in CI we test only VS2017
- Build it as a cmake project manually or use batch files from tools directory

.. compound::

Compilation using batch files ::

python -m pip install cmake==3.13.0
python -m pip install cmake==3.13.3
.\tools\build_win32.cmd
.\tools\build_win64.cmd

Expand All @@ -89,7 +89,7 @@ Linux

Compilation using bash file ::

python -m pip install cmake==3.13.0
python -m pip install cmake==3.13.3
./tools/build_linux.sh

MacOS
Expand All @@ -103,6 +103,6 @@ MacOS

Compilation using bash file ::

python -m pip install cmake==3.13.0
python -m pip install cmake==3.13.3
./tools/build_mac.sh

38 changes: 0 additions & 38 deletions docs/CoreModuleAPI.rst

This file was deleted.

36 changes: 26 additions & 10 deletions docs/DataFormatDesc.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,26 @@
Data Format Description
=========================

Units of Measure
------------------

For EEG, EMG, etc BrainFlow returns uV.

For timestamps BrainFlow uses UNIX timestamp, this count starts at the Unix Epoch on January 1st, 1970 at UTC.
Precision is microsecond, but for some boards timestamps are generated on PC side as soon as package was received.

You can compare BrainFlow's timestamp with time returned by code like this:

.. code-block:: python
import time
print (time.time ())
Generic Format Description
----------------------------

**Methods like:**
Methods like:

.. code-block:: python
Expand All @@ -30,36 +46,36 @@ Exact format for this array is board specific. To keep the API uniform. we have
get_timestamp_channel (board_id)
# and so on
**For some boards like OpenBCI Cyton, OpenBCI Ganglion and others we cannot separate EMG, EEG, EDA and ECG and in this case we return exactly the same array for all these methods but for some boards EMG and EEG channels will differ**
**For some boards like OpenBCI Cyton, OpenBCI Ganglion, etc we cannot separate EMG, EEG, EDA and ECG and in this case we return exactly the same array for all these methods but for some devices EMG and EEG channels will differ.**

Using the methods above, you can write completely board agnostic code and switch boards using a single parameter! Even if you have only one board using these methods you can easily switch to Synthetic board for development and run code without real hardware.
Using the methods above, you can write completely board agnostic code and switch boards using a single parameter! Even if you have only one board using these methods you can easily switch to Synthetic Board or Streaming Board.

Special channels for Cyton Based boards
-----------------------------------------
Special channels for OpenBCI Cyton based boards
-------------------------------------------------

`Cyton-based boards from OpenBCI <https://docs.openbci.com/docs/02Cyton/CytonLanding>`_ support different output formats, described `here <https://docs.openbci.com/docs/02Cyton/CytonDataFormat#firmware-version-200-fall-2016-to-now-1>`_.

**For Cyton based boards, we add Cyton End byte to a first channel from:**
For Cyton based boards, we add Cyton End byte to a first channel from:

.. code-block:: python
get_other_channels (board_id)
**If Cyton End bytes is equal to 0xC0 we add accel data. To get rows which contain accel data use:**
If Cyton End byte is equal to 0xC0 we add accel data. To get rows which contain accel data use:

.. code-block:: python
get_accel_channels (board_id)
**If Cyton End bytes is equal to 0xC1 we add analog data. To get rows which contain analog data use:**
If Cyton End byte is equal to 0xC1 we add analog data. To get rows which contain analog data use:

.. code-block:: python
get_analog_channels (board_id)
For analog data, we return int32 values. From low level API, we return double array, so these values are cast to double without any changes.
For analog data, we return int32 values. But since from low level API, we return double array, these values are converted to double without any changes.

**Also we add raw unprocessed bytes to the second and next channels returned by:**
Also we add raw unprocessed bytes to the second and next channels returned by:

.. code-block:: python
Expand Down

0 comments on commit c5d9555

Please sign in to comment.