avrgirl-stk500v2
Advanced tools
Comparing version 1.1.0 to 2.0.0
var C = require('./lib/c'); | ||
var EventEmitter = require('events').EventEmitter; | ||
var util = require('util'); | ||
var fs = require('fs'); | ||
var async = require('async'); | ||
var bufferEqual = require('buffer-equal'); | ||
var libusb = require('./lib/libusb-comms'); | ||
var serialcom = require('./lib/serialport-comms'); | ||
var fs = require('fs'); | ||
var intelhex = require('intel-hex'); | ||
@@ -42,4 +41,2 @@ | ||
var self = this; | ||
// libusb | ||
this.open(); | ||
this.device.setUpInterface(function(error) { | ||
@@ -67,3 +64,3 @@ if (!error) { | ||
var lLSB = buffer.length & 0xFF; | ||
var head = new Buffer([0x1B, this.seq, lMSB, lLSB, C.TOKEN]); | ||
var head = Buffer.from([0x1B, this.seq, lMSB, lLSB, C.TOKEN]); | ||
var headed = Buffer.concat([head, buffer]); | ||
@@ -78,3 +75,3 @@ | ||
var framed = Buffer.concat([headed, new Buffer([checksum])]); | ||
var framed = Buffer.concat([headed, Buffer.from([checksum])]); | ||
return framed; | ||
@@ -88,3 +85,3 @@ }; | ||
} | ||
var buffer = new Buffer(buffer); | ||
var buffer = Buffer.from(buffer); | ||
} | ||
@@ -131,3 +128,3 @@ | ||
var self = this; | ||
var cmd = new Buffer([C.CMD_SIGN_ON]); | ||
var cmd = Buffer.from([C.CMD_SIGN_ON]); | ||
var frameless = this.options.frameless; | ||
@@ -153,3 +150,3 @@ var readLen = frameless ? 3 : 9; | ||
var error = null; | ||
if (!bufferEqual(data, sig)) { | ||
if (!sig.equals(data)) { | ||
error = new Error('Failed to verify: signature does not match.'); | ||
@@ -167,3 +164,3 @@ } | ||
var cmd = new Buffer([C.CMD_LOAD_ADDRESS, msb, xsb, ysb, lsb]); | ||
var cmd = Buffer.from([C.CMD_LOAD_ADDRESS, msb, xsb, ysb, lsb]); | ||
@@ -186,3 +183,3 @@ this.sendCmd(cmd, function (error) { | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
cmd, | ||
@@ -266,3 +263,3 @@ lMSB, lLSB, | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_ENTER_PROGMODE_ISP, | ||
@@ -288,3 +285,3 @@ options.timeout, options.stabDelay, | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_LEAVE_PROGMODE_ISP, options.preDelay, options.postDelay | ||
@@ -304,3 +301,3 @@ ]); | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_CHIP_ERASE_ISP, | ||
@@ -375,3 +372,3 @@ erase.delay, options.pollMethod, | ||
var cmd = memType === 'flash' ? C.CMD_READ_FLASH_ISP : C.CMD_READ_EEPROM_ISP | ||
var buf = new Buffer([ | ||
var buf = Buffer.from([ | ||
cmd, | ||
@@ -396,2 +393,3 @@ length >> 8, length, | ||
var signature = options.signature; | ||
var signatureLength = signature.size; | ||
var frameless = this.options.frameless; | ||
@@ -403,3 +401,3 @@ var readLen = frameless ? 4 : 10; | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_READ_SIGNATURE_ISP, | ||
@@ -411,3 +409,3 @@ signature.startAddress, | ||
var response = new Buffer(3); | ||
var response = Buffer.alloc(3); | ||
@@ -422,3 +420,3 @@ function getSigByte() { | ||
cmd[4] = set; | ||
if (set < 3) { | ||
if (set < signatureLength) { | ||
getSigByte(); | ||
@@ -471,3 +469,3 @@ } else { | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_READ_FUSE_ISP, | ||
@@ -477,3 +475,3 @@ chip.fuses.startAddress | ||
var cmdf = Buffer.concat([cmd, new Buffer(fuse)], cmd.length + fuse.length); | ||
var cmdf = Buffer.concat([cmd, Buffer.from(fuse)], cmd.length + fuse.length); | ||
@@ -484,3 +482,3 @@ self.write(cmdf, function (error) { | ||
if (error) { callback(error); } | ||
response = new Buffer([data[fusePos]]); | ||
response = Buffer.from([data[fusePos]]); | ||
callback(null, response); | ||
@@ -499,3 +497,3 @@ }); | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_PROGRAM_FUSE_ISP, | ||
@@ -518,3 +516,3 @@ fuseCmd[0], fuseCmd[1], | ||
avrgirlStk500v2.prototype.setParameter = function (param, value, callback) { | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_SET_PARAMETER, | ||
@@ -532,3 +530,3 @@ param, value | ||
var self = this; | ||
var cmd = new Buffer([ | ||
var cmd = Buffer.from([ | ||
C.CMD_GET_PARAMETER, | ||
@@ -535,0 +533,0 @@ param |
97
lib/c.js
// thanks @soldair <3 | ||
const constants = {}; | ||
// STK message constants | ||
module.exports.MESSAGE_START = 0x1B | ||
module.exports.TOKEN = 0x0E | ||
constants.MESSAGE_START = 0x1B | ||
constants.TOKEN = 0x0E | ||
// STK general command constants | ||
module.exports.CMD_SIGN_ON = 0x01 | ||
module.exports.CMD_SET_PARAMETER = 0x02 | ||
module.exports.CMD_GET_PARAMETER = 0x03 | ||
module.exports.CMD_SET_DEVICE_PARAMETERS = 0x04 | ||
module.exports.CMD_OSCCAL = 0x05 | ||
module.exports.CMD_LOAD_ADDRESS = 0x06 | ||
module.exports.CMD_FIRMWARE_UPGRADE = 0x07 | ||
constants.CMD_SIGN_ON = 0x01 | ||
constants.CMD_SET_PARAMETER = 0x02 | ||
constants.CMD_GET_PARAMETER = 0x03 | ||
constants.CMD_SET_DEVICE_PARAMETERS = 0x04 | ||
constants.CMD_OSCCAL = 0x05 | ||
constants.CMD_LOAD_ADDRESS = 0x06 | ||
constants.CMD_FIRMWARE_UPGRADE = 0x07 | ||
// STK ISP command constants | ||
module.exports.CMD_ENTER_PROGMODE_ISP = 0x10 | ||
module.exports.CMD_LEAVE_PROGMODE_ISP = 0x11 | ||
module.exports.CMD_CHIP_ERASE_ISP = 0x12 | ||
module.exports.CMD_PROGRAM_FLASH_ISP = 0x13 | ||
module.exports.CMD_READ_FLASH_ISP = 0x14 | ||
module.exports.CMD_PROGRAM_EEPROM_ISP = 0x15 | ||
module.exports.CMD_READ_EEPROM_ISP = 0x16 | ||
module.exports.CMD_PROGRAM_FUSE_ISP = 0x17 | ||
module.exports.CMD_READ_FUSE_ISP = 0x18 | ||
module.exports.CMD_PROGRAM_LOCK_ISP = 0x19 | ||
module.exports.CMD_READ_LOCK_ISP = 0x1A | ||
module.exports.CMD_READ_SIGNATURE_ISP = 0x1B | ||
module.exports.CMD_READ_OSCCAL_ISP = 0x1C | ||
module.exports.CMD_SPI_MULTI = 0x1D | ||
constants.CMD_ENTER_PROGMODE_ISP = 0x10 | ||
constants.CMD_LEAVE_PROGMODE_ISP = 0x11 | ||
constants.CMD_CHIP_ERASE_ISP = 0x12 | ||
constants.CMD_PROGRAM_FLASH_ISP = 0x13 | ||
constants.CMD_READ_FLASH_ISP = 0x14 | ||
constants.CMD_PROGRAM_EEPROM_ISP = 0x15 | ||
constants.CMD_READ_EEPROM_ISP = 0x16 | ||
constants.CMD_PROGRAM_FUSE_ISP = 0x17 | ||
constants.CMD_READ_FUSE_ISP = 0x18 | ||
constants.CMD_PROGRAM_LOCK_ISP = 0x19 | ||
constants.CMD_READ_LOCK_ISP = 0x1A | ||
constants.CMD_READ_SIGNATURE_ISP = 0x1B | ||
constants.CMD_READ_OSCCAL_ISP = 0x1C | ||
constants.CMD_SPI_MULTI = 0x1D | ||
// STK status constants | ||
// Success | ||
module.exports.STATUS_CMD_OK = 0x00 | ||
constants.STATUS_CMD_OK = 0x00 | ||
// Warnings | ||
module.exports.STATUS_CMD_TOUT = 0x80 | ||
module.exports.STATUS_RDY_BSY_TOUT = 0x81 | ||
module.exports.STATUS_SET_PARAM_MISSING = 0x82 | ||
constants.STATUS_CMD_TOUT = 0x80 | ||
constants.STATUS_RDY_BSY_TOUT = 0x81 | ||
constants.STATUS_SET_PARAM_MISSING = 0x82 | ||
// Errors | ||
module.exports.STATUS_CMD_FAILED = 0xC0 | ||
module.exports.STATUS_CKSUM_ERROR = 0xC1 | ||
module.exports.STATUS_CMD_UNKNOWN = 0xC9 | ||
constants.STATUS_CMD_FAILED = 0xC0 | ||
constants.STATUS_CKSUM_ERROR = 0xC1 | ||
constants.STATUS_CMD_UNKNOWN = 0xC9 | ||
// STK parameter constants | ||
module.exports.STATUS_BUILD_NUMBER_LOW = 0x80 | ||
module.exports.STATUS_BUILD_NUMBER_HIGH = 0x81 | ||
module.exports.STATUS_HW_VER = 0x90 | ||
module.exports.STATUS_SW_MAJOR = 0x91 | ||
module.exports.STATUS_SW_MINOR = 0x92 | ||
module.exports.STATUS_VTARGET = 0x94 | ||
module.exports.STATUS_VADJUST = 0x95 | ||
module.exports.STATUS_OSC_PSCALE = 0x96 | ||
module.exports.STATUS_OSC_CMATCH = 0x97 | ||
module.exports.STATUS_SCK_DURATION = 0x98 | ||
module.exports.STATUS_TOPCARD_DETECT = 0x9A | ||
module.exports.STATUS_STATUS = 0x9C | ||
module.exports.STATUS_DATA = 0x9D | ||
module.exports.STATUS_RESET_POLARITY = 0x9E | ||
module.exports.STATUS_CONTROLLER_INIT = 0x9F | ||
constants.STATUS_BUILD_NUMBER_LOW = 0x80 | ||
constants.STATUS_BUILD_NUMBER_HIGH = 0x81 | ||
constants.STATUS_HW_VER = 0x90 | ||
constants.STATUS_SW_MAJOR = 0x91 | ||
constants.STATUS_SW_MINOR = 0x92 | ||
constants.STATUS_VTARGET = 0x94 | ||
constants.STATUS_VADJUST = 0x95 | ||
constants.STATUS_OSC_PSCALE = 0x96 | ||
constants.STATUS_OSC_CMATCH = 0x97 | ||
constants.STATUS_SCK_DURATION = 0x98 | ||
constants.STATUS_TOPCARD_DETECT = 0x9A | ||
constants.STATUS_STATUS = 0x9C | ||
constants.STATUS_DATA = 0x9D | ||
constants.STATUS_RESET_POLARITY = 0x9E | ||
constants.STATUS_CONTROLLER_INIT = 0x9F | ||
// STK answer constants | ||
module.exports.ANSWER_CKSUM_ERROR = 0xB0 | ||
constants.ANSWER_CKSUM_ERROR = 0xB0 | ||
constants.SEQ_SIGN_ON = [0x1b, 0x03, 0x00, 0x0b, 0x0e, 0x01, 0x00, 0x08, 0x41, 0x56, 0x52, 0x49, 0x53, 0x50, 0x5f, 0x32, 0x76]; | ||
module.exports = constants; |
var async = require('async'); | ||
var c = require('./c'); | ||
@@ -57,3 +58,3 @@ function serialCom (port) { | ||
var attempts = 0; | ||
var signon = new Buffer([0x1b, 0x03, 0x00, 0x0b, 0x0e, 0x01, 0x00, 0x08, 0x41, 0x56, 0x52, 0x49, 0x53, 0x50, 0x5f, 0x32, 0x76]); | ||
var signon = Buffer.from(c.SEQ_SIGN_ON); | ||
var drainDelay = 1000; | ||
@@ -60,0 +61,0 @@ |
{ | ||
"name": "avrgirl-stk500v2", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"description": "avrgirl flavoured stk500v2 protocol", | ||
"main": "avrgirl-stk500v2.js", | ||
"scripts": { | ||
"test": "tape ./tests/*.spec.js | tap-spec", | ||
"cover": "istanbul cover ./tests/avrgirl-stk500v2.spec.js && istanbul-coveralls" | ||
"test": "tape ./tests/*.spec.js | tap-spec" | ||
}, | ||
@@ -29,8 +28,5 @@ "repository": { | ||
"async": "^1.4.0", | ||
"buffer-equal": "0.0.1", | ||
"intel-hex": "^0.1.1" | ||
"intel-hex": "^0.1.2" | ||
}, | ||
"devDependencies": { | ||
"istanbul": "^0.4.0", | ||
"istanbul-coveralls": "^1.0.3", | ||
"mock-usb": "^1.0.1", | ||
@@ -37,0 +33,0 @@ "proxyquire": "^1.6.0", |
@@ -167,9 +167,9 @@ [![Build Status](https://travis-ci.org/noopkat/avrgirl-stk500v2.svg?branch=master)](https://travis-ci.org/noopkat/avrgirl-stk500v2) [![Coverage Status](https://coveralls.io/repos/noopkat/avrgirl-stk500v2/badge.svg?branch=master&service=github)](https://coveralls.io/github/noopkat/avrgirl-stk500v2?branch=master) | ||
var stk500v2 = require('avrgirl-stk500v2'); | ||
var serialport = require('serialport'); | ||
var SerialPort = serialport.SerialPort; | ||
var Serialport = require('serialport'); | ||
var sp = new SerialPort('/dev/cu.usbmodem1411', { | ||
baudrate: 115200, | ||
parser: serialport.parsers.raw | ||
}, false); | ||
var sp = new Serialport('/dev/cu.usbmodem1411', { | ||
baudRate: 115200, | ||
parser: Serialport.parsers.raw, | ||
autoOpen: false | ||
}); | ||
@@ -176,0 +176,0 @@ var mega = { |
@@ -6,3 +6,2 @@ // harness | ||
var proxyquire = require('proxyquire'); | ||
var bufferEqual = require('buffer-equal'); | ||
var chip = require('./helpers/mock-chip'); | ||
@@ -24,3 +23,3 @@ var libusbmock = require('./helpers/mock-libusb-comms'); | ||
function testBuffer(spy, call, arg, buffer) { | ||
return (spy.called && spy.args[call][arg] && bufferEqual(spy.args[call][arg], buffer)); | ||
return (spy.called && spy.args[call][arg] && buffer.equals(spy.args[call][arg])); | ||
}; | ||
@@ -90,4 +89,4 @@ | ||
var a = new avrgirl(FLoptions); | ||
var buffer = new Buffer([0xff, 0xff, 0xff, 0xff]); | ||
var framedExample = new Buffer([0x1b, 0x00, 0x00, 0x04, 0x0e, 0xff, 0xff, 0xff, 0xff, 0x11]); | ||
var buffer = Buffer.from([0xff, 0xff, 0xff, 0xff]); | ||
var framedExample = Buffer.from([0x1b, 0x00, 0x00, 0x04, 0x0e, 0xff, 0xff, 0xff, 0xff, 0x11]); | ||
var framed = a.frame(buffer); | ||
@@ -97,3 +96,3 @@ | ||
t.equal(framed.length, 10, 'returned result length is correct'); | ||
t.ok(bufferEqual(framedExample, framed), 'returned result equals expected value'); | ||
t.ok(framed.equals(framedExample), 'returned result equals expected value'); | ||
t.end(); | ||
@@ -104,3 +103,3 @@ }); | ||
var a = new avrgirl(FLoptions); | ||
var buffer = new Buffer([0xff, 0xff, 0xff, 0xff]); | ||
var buffer = Buffer.from([0xff, 0xff, 0xff, 0xff]); | ||
var array = [0xff, 0xff, 0xff, 0xff]; | ||
@@ -125,3 +124,3 @@ | ||
var a = new avrgirl(FLoptions); | ||
var buffer = new Buffer([0xff, 0x00, 0xff, 0xff, 0xff, 0xff]); | ||
var buffer = Buffer.from([0xff, 0x00, 0xff, 0xff, 0xff, 0xff]); | ||
@@ -133,3 +132,3 @@ t.plan(4); | ||
t.equal(data.length, 6, 'read result length is expected'); | ||
t.ok(bufferEqual(buffer, data), 'buffer read is expected value'); | ||
t.ok(data.equals(buffer), 'buffer read is expected value'); | ||
}); | ||
@@ -144,4 +143,4 @@ | ||
var a = new avrgirl(FLoptions); | ||
var cmd = new Buffer([0x01]); | ||
var buffer = new Buffer([0xff, 0x00, 0xff, 0xff, 0xff, 0xff]); | ||
var cmd = Buffer.from([0x01]); | ||
var buffer = Buffer.from([0xff, 0x00, 0xff, 0xff, 0xff, 0xff]); | ||
@@ -167,3 +166,3 @@ t.plan(3); | ||
var spyr = sinon.spy(a, 'read'); | ||
var buf = new Buffer([0x01]); | ||
var buf = Buffer.from([0x01]); | ||
@@ -181,5 +180,5 @@ t.plan(3); | ||
var a = new avrgirl(FLoptions); | ||
var data = new Buffer([0x01, 0x02, 0x03]); | ||
var sig2 = new Buffer([0x01, 0x02, 0x03]); | ||
var sig3 = new Buffer([0xf3, 0xf4, 0xf5]); | ||
var data = Buffer.from([0x01, 0x02, 0x03]); | ||
var sig2 = Buffer.from([0x01, 0x02, 0x03]); | ||
var sig3 = Buffer.from([0xf3, 0xf4, 0xf5]); | ||
@@ -208,4 +207,4 @@ t.plan(2); | ||
var buf1 = new Buffer([0x06, msb1, xsb, ysb, lsb]); | ||
var buf2 = new Buffer([0x06, msb2, xsb, ysb, lsb]); | ||
var buf1 = Buffer.from([0x06, msb1, xsb, ysb, lsb]); | ||
var buf2 = Buffer.from([0x06, msb2, xsb, ysb, lsb]); | ||
t.plan(4); | ||
@@ -229,6 +228,6 @@ | ||
var lLSB = 5 & 0xFF; | ||
var data = new Buffer([0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
var data = Buffer.from([0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
var baddata = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF]; | ||
var buf1 = new Buffer([0x13, lMSB, lLSB, 0xC1, 6, 0x40, 0x4C, 0x20, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
var buf2 = new Buffer([0x15, lMSB, lLSB, 0xC1, 6, 0xC1, 0xC2, 0xA0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
var buf1 = Buffer.from([0x13, lMSB, lLSB, 0xC1, 6, 0x40, 0x4C, 0x20, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
var buf2 = Buffer.from([0x15, lMSB, lLSB, 0xC1, 6, 0xC1, 0xC2, 0xA0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]); | ||
@@ -255,3 +254,3 @@ t.plan(5); | ||
var spy = sinon.spy(a, 'sendCmd'); | ||
var buf = new Buffer([0x10, 0xC8, 0x64, 0x19, 0x20, 0x00, 0x53, 0x03, 0xAC, 0x53, 0x00, 0x00]); | ||
var buf = Buffer.from([0x10, 0xC8, 0x64, 0x19, 0x20, 0x00, 0x53, 0x03, 0xAC, 0x53, 0x00, 0x00]); | ||
@@ -269,3 +268,3 @@ t.plan(2); | ||
var spy = sinon.spy(a, 'sendCmd'); | ||
var buf = new Buffer([0x11, 0x01, 0x01]); | ||
var buf = Buffer.from([0x11, 0x01, 0x01]); | ||
@@ -283,3 +282,3 @@ t.plan(2); | ||
var spy = sinon.spy(a, 'sendCmd'); | ||
var buf = new Buffer([0x12, 10, 0x01, 0xAC, 0x80, 0x00, 0x00]); | ||
var buf = Buffer.from([0x12, 10, 0x01, 0xAC, 0x80, 0x00, 0x00]); | ||
@@ -300,4 +299,4 @@ t.plan(2); | ||
var lLSB = 0x04; | ||
var buf1 = new Buffer([0x14, lMSB, lLSB, 0x20]); | ||
var buf2 = new Buffer([0x16, lMSB, lLSB, 0xA0]); | ||
var buf1 = Buffer.from([0x14, lMSB, lLSB, 0x20]); | ||
var buf2 = Buffer.from([0x16, lMSB, lLSB, 0xA0]); | ||
@@ -328,3 +327,3 @@ t.plan(10); | ||
var spy = sinon.spy(a, 'sendCmd'); | ||
var buf = new Buffer([0x02, 0x98, 0x01]); | ||
var buf = Buffer.from([0x02, 0x98, 0x01]); | ||
@@ -343,3 +342,3 @@ t.plan(2); | ||
var spyr = sinon.spy(a, 'read'); | ||
var buf = new Buffer([0x03, 0x98]); | ||
var buf = Buffer.from([0x03, 0x98]); | ||
@@ -397,4 +396,4 @@ t.plan(4); | ||
var spy = sinon.spy(a, 'writeMem'); | ||
var tinydata = new Buffer(50); | ||
var largedata = new Buffer(500); | ||
var tinydata = Buffer.alloc(50); | ||
var largedata = Buffer.alloc(500); | ||
var file = __dirname + '/data/pr.hex'; | ||
@@ -426,4 +425,4 @@ | ||
var spy = sinon.spy(a, 'writeMem'); | ||
var tinydata = new Buffer(3); | ||
var largedata = new Buffer(20); | ||
var tinydata = Buffer.alloc(3); | ||
var largedata = Buffer.alloc(20); | ||
var file = __dirname + '/data/eeprom.hex'; | ||
@@ -483,6 +482,6 @@ | ||
var a = new avrgirl(FLoptions); | ||
var tinyfdata = new Buffer(50); | ||
var largefdata = new Buffer(500); | ||
var tinyedata = new Buffer(3); | ||
var largeedata = new Buffer(50); | ||
var tinyfdata = Buffer.alloc(50); | ||
var largefdata = Buffer.alloc(500); | ||
var tinyedata = Buffer.alloc(3); | ||
var largeedata = Buffer.alloc(50); | ||
@@ -561,3 +560,3 @@ t.plan(4); | ||
var a = new avrgirl(FLoptions); | ||
var buf = new Buffer([0x17, 0xAC, 0xA4, 0x00, 0xFF]); | ||
var buf = Buffer.from([0x17, 0xAC, 0xA4, 0x00, 0xFF]); | ||
var spyw = sinon.spy(a, 'write'); | ||
@@ -564,0 +563,0 @@ var spyr = sinon.spy(a, 'read'); |
@@ -6,5 +6,5 @@ // check for all props | ||
test('[ C ] length of props', function (t) { | ||
var cKeysLen = 46; | ||
var cKeysLen = 47; | ||
t.equal(Object.keys(C).length, cKeysLen, 'length of props list is correct'); | ||
t.end(); | ||
}); |
module.exports = { | ||
signature: [0x1E, 0x92, 0x06], | ||
sig: [0x1E, 0x92, 0x06], | ||
signature: { | ||
size: 3, | ||
startAddress: 0x00, | ||
read: [0x30, 0x00, 0x00, 0x00] | ||
}, | ||
timeout: 0xC8, | ||
@@ -46,6 +51,2 @@ stabDelay: 0x64, | ||
}, | ||
signature: { | ||
startAddress: 0x00, | ||
read: [0x30, 0x00, 0x00, 0x00] | ||
}, | ||
fuses: { | ||
@@ -52,0 +53,0 @@ startAddress: 0x00, |
@@ -19,3 +19,3 @@ function libusb (device) { | ||
libusb.prototype.read = function (length, callback) { | ||
var data = new Buffer(length); | ||
var data = Buffer.alloc(length); | ||
data.fill(0xFF); | ||
@@ -22,0 +22,0 @@ data[1] = 0x00; |
@@ -5,3 +5,2 @@ // harness | ||
var sinon = require('sinon'); | ||
var bufferEqual = require('buffer-equal'); | ||
var usb = require('mock-usb'); | ||
@@ -54,3 +53,3 @@ | ||
var b = new libusb(device); | ||
var buf = new Buffer([0x01]); | ||
var buf = Buffer.from([0x01]); | ||
@@ -64,3 +63,3 @@ t.plan(2); | ||
t.error(error, 'no error'); | ||
var cond = (spy.calledOnce && spy.args[0][0] && bufferEqual(spy.args[0][0], buf)); | ||
var cond = (spy.calledOnce && spy.args[0][0] && buf.equals(spy.args[0][0])); | ||
t.ok(cond, 'called transfer method on correct endpoint with correct buffer arg'); | ||
@@ -67,0 +66,0 @@ }); |
@@ -5,3 +5,2 @@ // harness | ||
var sinon = require('sinon'); | ||
var bufferEqual = require('buffer-equal'); | ||
var vserial = require('virtual-serialport'); | ||
@@ -77,3 +76,3 @@ //var vserialport = vserial.SerialPort; | ||
var b = new serialcom(device); | ||
var buf = new Buffer([0x01]); | ||
var buf = Buffer.from([0x01]); | ||
@@ -84,3 +83,3 @@ t.plan(1); | ||
b.write(buf); | ||
var cond = (spy.calledOnce && spy.args[0][0] && bufferEqual(spy.args[0][0], buf)); | ||
var cond = (spy.calledOnce && spy.args[0][0] && buf.equals(spy.args[0][0])); | ||
t.ok(cond, 'called write method on correct endpoint with correct buffer arg'); | ||
@@ -91,3 +90,3 @@ }); | ||
var b = new serialcom(device); | ||
b.responses.push(new Buffer(8)); | ||
b.responses.push(Buffer.alloc(8)); | ||
var spy = sinon.spy(b, 'read'); | ||
@@ -94,0 +93,0 @@ t.plan(3); |
68198
2
6
19
1464
- Removedbuffer-equal@0.0.1
- Removedbuffer-equal@0.0.1(transitive)
Updatedintel-hex@^0.1.2