* refactor(usb): Rewrite jump-to-bootloder to node-hid * refactor(usb): Rewrite the whole usb packages to HID-API * refactor(usb): Deleted not valid usb command files * refactor(usb): Deleted not supported usb commands * Remove obsolete script. * Remove obsolete script. * Fix script. * Fix script. * No need to assign the silent property because it has been removed. * This workaround may work on other platforms, but it certainly doesn't work on Linux. It makes some scripts not work, so I'm commenting it out. * Fix bootloader VID and PID.
17 lines
472 B
JavaScript
Executable File
17 lines
472 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
const uhk = require('./uhk');
|
|
|
|
const device = uhk.getUhkDevice();
|
|
|
|
function readAdc() {
|
|
const data = uhk.getTransferData(new Buffer([uhk.usbCommands.readAdc]));
|
|
console.log('Sending ', data);
|
|
device.write(data);
|
|
const receivedBuffer = Buffer.from(device.readSync());
|
|
console.log('Received', uhk.bufferToString(receivedBuffer), (receivedBuffer[1]*255 + receivedBuffer[0])/4096*5.5*1.045);
|
|
|
|
setTimeout(readAdc, 500)
|
|
}
|
|
|
|
readAdc();
|