feat(config): Read / write hardware configuration area (#423)
* add write-hca.js * refactor: Move config serializer into the uhk-common package * refactor: Move getTransferBuffers into the uhk-usb package * refactor: delete obsoleted classes * build: add uhk-usb build command * refactor: move eeprom transfer to uhk-usb package * fix: Fix write-hca.js * feat: load hardware config from the device and * style: fix ts lint errors * build: fix rxjs dependency resolve * test: Add jasmine unit test framework to the tet serializer * fix(user-config): A "type": "basic", properties to the "keystroke" action types * feat(usb): set chmod+x on write-hca.js * feat(usb): Create USB logger * style: Fix type * build: Add chalk to dependencies. Chalk will colorize the output
This commit is contained in:
committed by
László Monda
parent
1122784bdb
commit
9294bede50
@@ -1,4 +1,6 @@
|
||||
const HID = require('node-hid');
|
||||
// const debug = process.env.DEBUG;
|
||||
const debug = true;
|
||||
|
||||
function bufferToString(buffer) {
|
||||
let str = '';
|
||||
@@ -78,8 +80,10 @@ exports = module.exports = moduleExports = {
|
||||
writeUserConfig: 3,
|
||||
},
|
||||
leftLedDriverAddress: 0b1110100,
|
||||
rightLedDriverAddress: 0b1110111
|
||||
}
|
||||
rightLedDriverAddress: 0b1110111,
|
||||
sendLog: sendLog,
|
||||
readLog: readLog
|
||||
};
|
||||
|
||||
function convertBufferToIntArray(buffer) {
|
||||
return Array.prototype.slice.call(buffer, 0)
|
||||
@@ -101,3 +105,18 @@ function getTransferData(buffer) {
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
function readLog(buffer) {
|
||||
writeLog('USB[R]: ', buffer)
|
||||
}
|
||||
|
||||
function sendLog(buffer) {
|
||||
writeLog('USB[W]: ', buffer)
|
||||
}
|
||||
|
||||
function writeLog(prefix, buffer) {
|
||||
if (!debug) {
|
||||
return;
|
||||
}
|
||||
console.log(prefix + bufferToString(buffer))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user