Extract sendKbootCommandToModule() from send-kboot-command-to-module.js to uhk.js
This commit is contained in:
@@ -33,6 +33,6 @@ if (kbootCommand !== 'idle') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const device = uhk.getUhkDevice();
|
const device = uhk.getUhkDevice();
|
||||||
let transfer = new Buffer([uhk.usbCommands.sendKbootCommandToModule, kbootCommandId, parseInt(i2cAddress)]);
|
(async function() {
|
||||||
device.write(uhk.getTransferData(transfer));
|
await uhk.sendKbootCommandToModule(device, kbootCommandId, i2cAddress);
|
||||||
const response = Buffer.from(device.readSync());
|
})();
|
||||||
|
|||||||
@@ -196,6 +196,10 @@ function reenumerate(enumerationMode) {
|
|||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
async function sendKbootCommandToModule(device, kbootCommandId, i2cAddress) {
|
||||||
|
return await uhk.writeDevice(device, [uhk.usbCommands.sendKbootCommandToModule, kbootCommandId, parseInt(i2cAddress)])
|
||||||
|
};
|
||||||
|
|
||||||
uhk = exports = module.exports = moduleExports = {
|
uhk = exports = module.exports = moduleExports = {
|
||||||
bufferToString,
|
bufferToString,
|
||||||
getUint16,
|
getUint16,
|
||||||
@@ -211,6 +215,7 @@ uhk = exports = module.exports = moduleExports = {
|
|||||||
execRetry,
|
execRetry,
|
||||||
updateDeviceFirmware,
|
updateDeviceFirmware,
|
||||||
reenumerate,
|
reenumerate,
|
||||||
|
sendKbootCommandToModule,
|
||||||
usbCommands: {
|
usbCommands: {
|
||||||
getDeviceProperty : 0x00,
|
getDeviceProperty : 0x00,
|
||||||
reenumerate : 0x01,
|
reenumerate : 0x01,
|
||||||
|
|||||||
Reference in New Issue
Block a user