Skip to content

Commit b24e9de

Browse files
author
AJ Keller
committed
Add new function for board type given number of channels
1 parent 72244af commit b24e9de

File tree

5 files changed

+36
-4
lines changed

5 files changed

+36
-4
lines changed

Diff for: .travis.yml

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ node_js:
77
install:
88
- npm install --all
99
script:
10-
- npm run test-lint
11-
- npm run test-cov
10+
- npm run test

Diff for: changelog.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 0.0.10
2+
3+
### New Function
4+
5+
* Add `boardTypeForNumberOfChannels()` to Constants
6+
17
# 0.0.9
28

39
### New Features

Diff for: openBCIConstants.js

+13
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,19 @@ const constantsModule = {
907907
return obciNumberOfChannelsDefault;
908908
}
909909
},
910+
boardTypeForNumberOfChannels: (numberOfChannels) => {
911+
switch (numberOfChannels) {
912+
case obciNumberOfChannelsDaisy:
913+
return obciBoardDaisy;
914+
case obciNumberOfChannelsGanglion:
915+
return obciBoardGanglion;
916+
case 0:
917+
return obciBoardNone;
918+
case obciNumberOfChannelsDefault:
919+
default:
920+
return obciBoardCyton;
921+
}
922+
},
910923
/** Possible Sample Rates */
911924
OBCISampleRate1000: obciSampleRate1000,
912925
OBCISampleRate125: obciSampleRate125,

Diff for: package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "openbci-utilities",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"description": "The official utility package of Node.js SDK for the OpenBCI Biosensor Boards.",
55
"main": "index.js",
66
"scripts": {
7-
"test": "mocha test",
7+
"test": "npm run test-lint && npm run test-cov",
88
"test-lint": "semistandard | snazzy",
99
"test-cov": "istanbul cover ./node_modules/mocha/bin/_mocha -- -R spec && codecov"
1010
},

Diff for: test/openBCIConstants-test.js

+14
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,20 @@ describe('OpenBCIConstants', function () {
995995
expect(k.numberOfChannelsForBoardType(k.OBCIBoardNone)).to.equal(0);
996996
});
997997
});
998+
describe('boardTypeForNumberOfChannels', function () {
999+
it('should get daisy board right for num chan', function () {
1000+
expect(k.boardTypeForNumberOfChannels(16)).to.equal(k.OBCIBoardDaisy);
1001+
});
1002+
it('should get cyton board right for num chan', function () {
1003+
expect(k.boardTypeForNumberOfChannels(8)).to.equal(k.OBCIBoardCyton);
1004+
});
1005+
it('should get ganglion right for num chan', function () {
1006+
expect(k.boardTypeForNumberOfChannels(4)).to.equal(k.OBCIBoardGanglion);
1007+
});
1008+
it('should get none right for num chan', function () {
1009+
expect(k.boardTypeForNumberOfChannels(0)).to.equal(k.OBCIBoardNone);
1010+
});
1011+
});
9981012
describe('#getChannelSetter', function () {
9991013
// 'channel 1, power on, gain 24, inputType normal, bias include, srb2 connect, srb1 dissconnect'
10001014
describe('channel input selection works', function () {

0 commit comments

Comments
 (0)