-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #683 from songjoonsuk/develop-hw
신규 보드 (센서우노/센서우노블루투스) 등록건
- Loading branch information
Showing
8 changed files
with
1,138 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
function Module() { | ||
this.digitalValue = new Array(12); | ||
this.analogValue = new Array(8); | ||
this.remoteDigitalValue = [0,0,0,0,0,0,0,0,0,0,0,0]; | ||
this.readablePorts = null; | ||
this.remainValue = null; | ||
} | ||
|
||
Module.prototype.init = function(handler, config) { | ||
}; | ||
|
||
|
||
Module.prototype.requestInitialData = function() { | ||
return null; | ||
}; | ||
|
||
Module.prototype.checkInitialData = function(data, config) { | ||
return true; | ||
}; | ||
|
||
Module.prototype.validateLocalData = function(data) { | ||
return true; | ||
}; | ||
|
||
|
||
Module.prototype.handleRemoteData = function(handler) { | ||
this.readablePorts = handler.read('readablePorts'); | ||
var digitalValue = this.remoteDigitalValue; | ||
for (var port = 0; port < 12; port++) { | ||
digitalValue[port] = handler.read(port); | ||
} | ||
}; | ||
|
||
Module.prototype.requestLocalData = function() { | ||
var queryString = []; | ||
|
||
var readablePorts = this.readablePorts; | ||
if (readablePorts) { | ||
for (var i in readablePorts) { | ||
var query = (5 << 5) + (readablePorts[i] << 1); | ||
queryString.push(query); | ||
} | ||
} | ||
|
||
var digitalValue = this.remoteDigitalValue; | ||
for (var port = 0; port < 12; port++) { | ||
var value = digitalValue[port]; | ||
if (value === 255 || value === 0) { | ||
var query = (7 << 5) + (port << 1) + (value == 255 ? 1 : 0); | ||
queryString.push(query); | ||
} else if (value > 0 && value < 255) { | ||
var query = (6 << 5) + (port << 1) + (value >> 7); | ||
queryString.push(query); | ||
query = value & 127; | ||
queryString.push(query); | ||
} | ||
} | ||
return queryString; | ||
}; | ||
|
||
Module.prototype.handleLocalData = function(data) { // data: Native Buffer | ||
var pointer = 0; | ||
for (var i = 0; i < 32; i++) { | ||
var chunk; | ||
if(!this.remainValue) { | ||
chunk = data[i]; | ||
} else { | ||
chunk = this.remainValue; | ||
i--; | ||
} | ||
if (chunk >> 7) { | ||
if ((chunk >> 6) & 1) { | ||
var nextChunk = data[i + 1]; | ||
if(!nextChunk && nextChunk !== 0) { | ||
this.remainValue = chunk; | ||
} | ||
else { | ||
this.remainValue = null; | ||
|
||
var port = (chunk >> 3) & 7; | ||
this.analogValue[port] = ((chunk & 7) << 7) + | ||
(nextChunk & 127); | ||
} | ||
i++; | ||
} | ||
else { | ||
var port = (chunk >> 2) & 15; | ||
this.digitalValue[port] = chunk & 1; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Module.prototype.requestRemoteData = function(handler) { | ||
for (var i = 0; i < this.analogValue.length; i++) { | ||
var value = this.analogValue[i]; | ||
handler.write('a' + i, value); | ||
} | ||
for (var i = 0; i < this.digitalValue.length; i++) { | ||
var value = this.digitalValue[i]; | ||
handler.write(i, value); | ||
} | ||
}; | ||
|
||
Module.prototype.reset = function() { | ||
}; | ||
|
||
module.exports = new Module(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{ | ||
"id": "570101", | ||
"name": { | ||
"en": "Sensor Uno", | ||
"ko": "센서우노(USB)" | ||
}, | ||
"category": "board", | ||
"platform": ["win32", "darwin"], | ||
"icon": "suno.png", | ||
"module": "suno.js", | ||
"url": "https://excitetouch.com", | ||
"email": "[email protected]", | ||
"driver": [ | ||
{ | ||
"win32-ia32": "CH34x_Install_Windows_v3_4/CH34x_Install_Windows_v3_4.EXE", | ||
"win32-x64": "CH34x_Install_Windows_v3_4/CH34x_Install_Windows_v3_4.EXE", | ||
"darwin-x64": "https://entrylabs.github.io/docs/files/drivers/CH34x_Install_MAC_10_9_AND_ABOVE/CH34x_Install_V1.3.pkg", | ||
"translate": "드라이버 (유선용)" | ||
}, | ||
{ | ||
"win32-ia32": "SUNOBT/CP210xVCPInstaller_x86.exe", | ||
"win32-x64": "SUNOBT/CP210xVCPInstaller_x64.exe", | ||
"darwin-x64": "Mac_OSX_VCP_Driver/SiLabsUSBDriverDisk.dmg", | ||
"translate": "드라이버 (블루투스)" | ||
} | ||
], | ||
"reconnect": true, | ||
"firmware": [ | ||
{ | ||
"name": "suno", | ||
"translate": "펌웨어 (USB케이블)" | ||
}, | ||
{ | ||
"name": "sunobt", | ||
"translate": "펌웨어 (블루투스)" | ||
} | ||
], | ||
"hardware": { | ||
"type": "serial", | ||
"control": "slave", | ||
"duration": 48, | ||
"vendor": { | ||
"win32": ["wch.cn", "Arduino"] | ||
}, | ||
"baudRate": 57600 | ||
|
||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
function Module() { | ||
this.digitalValue = new Array(12); | ||
this.analogValue = new Array(8); | ||
this.remoteDigitalValue = [0,0,0,0,0,0,0,0,0,0,0,0]; | ||
this.readablePorts = null; | ||
this.remainValue = null; | ||
} | ||
|
||
Module.prototype.init = function(handler, config) { | ||
}; | ||
|
||
|
||
Module.prototype.requestInitialData = function() { | ||
return null; | ||
}; | ||
|
||
Module.prototype.checkInitialData = function(data, config) { | ||
return true; | ||
}; | ||
|
||
Module.prototype.validateLocalData = function(data) { | ||
return true; | ||
}; | ||
|
||
|
||
Module.prototype.handleRemoteData = function(handler) { | ||
this.readablePorts = handler.read('readablePorts'); | ||
var digitalValue = this.remoteDigitalValue; | ||
for (var port = 0; port < 12; port++) { | ||
digitalValue[port] = handler.read(port); | ||
} | ||
}; | ||
|
||
Module.prototype.requestLocalData = function() { | ||
var queryString = []; | ||
|
||
var readablePorts = this.readablePorts; | ||
if (readablePorts) { | ||
for (var i in readablePorts) { | ||
var query = (5 << 5) + (readablePorts[i] << 1); | ||
queryString.push(query); | ||
} | ||
} | ||
|
||
var digitalValue = this.remoteDigitalValue; | ||
for (var port = 0; port < 12; port++) { | ||
var value = digitalValue[port]; | ||
if (value === 255 || value === 0) { | ||
var query = (7 << 5) + (port << 1) + (value == 255 ? 1 : 0); | ||
queryString.push(query); | ||
} else if (value > 0 && value < 255) { | ||
var query = (6 << 5) + (port << 1) + (value >> 7); | ||
queryString.push(query); | ||
query = value & 127; | ||
queryString.push(query); | ||
} | ||
} | ||
return queryString; | ||
}; | ||
|
||
Module.prototype.handleLocalData = function(data) { // data: Native Buffer | ||
var pointer = 0; | ||
for (var i = 0; i < 32; i++) { | ||
var chunk; | ||
if(!this.remainValue) { | ||
chunk = data[i]; | ||
} else { | ||
chunk = this.remainValue; | ||
i--; | ||
} | ||
if (chunk >> 7) { | ||
if ((chunk >> 6) & 1) { | ||
var nextChunk = data[i + 1]; | ||
if(!nextChunk && nextChunk !== 0) { | ||
this.remainValue = chunk; | ||
} | ||
else { | ||
this.remainValue = null; | ||
|
||
var port = (chunk >> 3) & 7; | ||
this.analogValue[port] = ((chunk & 7) << 7) + | ||
(nextChunk & 127); | ||
} | ||
i++; | ||
} | ||
else { | ||
var port = (chunk >> 2) & 15; | ||
this.digitalValue[port] = chunk & 1; | ||
} | ||
} | ||
} | ||
}; | ||
|
||
Module.prototype.requestRemoteData = function(handler) { | ||
for (var i = 0; i < this.analogValue.length; i++) { | ||
var value = this.analogValue[i]; | ||
handler.write('a' + i, value); | ||
} | ||
for (var i = 0; i < this.digitalValue.length; i++) { | ||
var value = this.digitalValue[i]; | ||
handler.write(i, value); | ||
} | ||
}; | ||
|
||
Module.prototype.reset = function() { | ||
}; | ||
|
||
module.exports = new Module(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"id": "570102", | ||
"name": { | ||
"en": "Sensor Uno (Bluetooth)", | ||
"ko": "센서우노(블루투스)" | ||
}, | ||
"category": "board", | ||
"platform": ["win32", "darwin"], | ||
"icon": "sunobt.png", | ||
"module": "sunobt.js", | ||
"url": "https://excitetouch.com", | ||
"email": "[email protected]", | ||
"reconnect": true, | ||
"selectPort": true, | ||
"hardware": { | ||
"type": "bluetooth", | ||
"control": "slave", | ||
"duration": 48, | ||
"vendor": "Microsoft", | ||
"baudRate": 57600 | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.