Add scripts for getting/setting firmware variables (#734)

This commit is contained in:
Eric Tang
2018-07-22 07:07:21 -07:00
committed by László Monda
parent e7cf8dc966
commit ac89aff018
3 changed files with 29 additions and 0 deletions

11
packages/usb/get-variable.js Executable file
View File

@@ -0,0 +1,11 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.getVariable, +process.argv[2]]);
console.log(sendData);
device.write(uhk.getTransferData(sendData));
const receivedBuffer = Buffer.from(device.readSync());
console.log(receivedBuffer[1]);

10
packages/usb/set-variable.js Executable file
View File

@@ -0,0 +1,10 @@
#!/usr/bin/env node
const uhk = require('./uhk');
const device = uhk.getUhkDevice();
const sendData = new Buffer([uhk.usbCommands.setVariable, +process.argv[2], +process.argv[3]]);
console.log(sendData);
device.write(uhk.getTransferData(sendData));

View File

@@ -450,6 +450,14 @@ uhk = exports = module.exports = moduleExports = {
getSlaveI2cErrors : 0x0f,
setI2cBaudRate : 0x10,
switchKeymap : 0x11,
getVariable : 0x12,
setVariable : 0x13,
},
usbVariables: {
testSwitches : 0x00,
testUsbStack : 0x01,
debounceTimePress : 0x02,
debounceTimeRelease : 0x03,
},
enumerationModes: {
bootloader: 0,