Add EEPROM stress testing scripts.

This commit is contained in:
László Monda
2017-08-07 03:02:21 +02:00
parent 941ff7053b
commit f6e67d0e73
7 changed files with 135 additions and 7 deletions

View File

@@ -66,7 +66,9 @@ function sendUsbPacketsByCallback(packetProvider, options={}) {
return;
}
console.log('Sending: ', bufferToString(packet));
if (!moduleExports.silent) {
console.log('Sending: ', bufferToString(packet));
}
let [endpointIn, endpointOut] = usbEndpoints || getUsbEndpoints();
endpointOut.transfer(packet, function(err) {
@@ -83,7 +85,9 @@ function sendUsbPacketsByCallback(packetProvider, options={}) {
console.error("USB error: %s", err2);
process.exit(2);
}
console.log('Received:', bufferToString(receivedBuffer));
if (!moduleExports.silent) {
console.log('Received:', bufferToString(receivedBuffer));
}
(receiveCallback || (()=>{}))(receivedBuffer);
sendUsbPacketsByCallback(packetProvider);
})
@@ -102,7 +106,7 @@ function sendUsbPackets(packets, options={}) {
}, options)
}
exports = module.exports = {
exports = module.exports = moduleExports = {
DelayMs,
bufferToString,
getUhkDevice,
@@ -140,6 +144,12 @@ exports = module.exports = {
hardwareConfigSize: 4,
userConfigSize: 5,
},
eepromTransfer: {
readHardwareConfig: 0,
writeHardwareConfig: 1,
readUserConfig: 2,
writeUserConfig: 3,
},
leftLedDriverAddress: 0b1110100,
rightLedDriverAddress: 0b1110111
}