attiny-common
Advanced tools
Comparing version 0.0.8 to 0.0.9
@@ -32,3 +32,4 @@ /* | ||
this.irq = hardware.digital[2].rawWrite(false); | ||
this.spi = hardware.SPI({clockSpeed : 1000, dataMode:2, chipSelect:this.chipSelect, chipSelectDelayUs:500}); | ||
this.defaultSPISettings = {clockSpeed : 1000, dataMode:2, chipSelect:this.chipSelect, chipSelectDelayUs:500}; | ||
this.spi = hardware.SPI(this.defaultSPISettings); | ||
this.transmitting = false; | ||
@@ -80,7 +81,7 @@ this.listening = false; | ||
}); | ||
} | ||
} | ||
else { | ||
// Continue with the initialziation process | ||
self._checkModuleInformation(firmwareOptions, readFirmwareVersion, readModuleID, callback); | ||
} | ||
} | ||
}); | ||
@@ -112,3 +113,3 @@ }); | ||
// But the module ID is wring, this is bad | ||
else if (readModuleID != firmwareOptions.moduleID) { | ||
else if (readModuleID != firmwareOptions.moduleID) { | ||
@@ -164,11 +165,11 @@ // Abort so we don't flash the wrong firmware | ||
}); | ||
}; | ||
}; | ||
Attiny.prototype.getFirmwareVersion = function (callback) { | ||
this.getModuleInformation(FIRMWARE_CMD, callback); | ||
}; | ||
}; | ||
Attiny.prototype.getModuleID = function (callback) { | ||
this.getModuleInformation(MODULE_ID_CMD, callback); | ||
}; | ||
}; | ||
@@ -190,3 +191,3 @@ Attiny.prototype.getModuleInformation = function(cmd, callback) { | ||
var self = this; | ||
// Update the firmware | ||
// Update the firmware | ||
isp.updateFirmware(this.hardware, firmwareOptions, function crcMatch(err) { | ||
@@ -200,7 +201,9 @@ | ||
} | ||
// Give the tiny some time to settle | ||
setTimeout( function(){ | ||
// Then confirm the CRC is what we think it is | ||
self.CRCCheck(firmwareOptions.crc, callback) | ||
}, 500); | ||
// Reset the chip so it reboots | ||
self._reset(function() { | ||
// Reset our SPI instance to the correct settings (1kHz) | ||
self.spi = self.hardware.SPI(self.defaultSPISettings); | ||
// Check the CRC was set correctly | ||
self.CRCCheck(firmwareOptions.crc, callback) | ||
}); | ||
}); | ||
@@ -275,3 +278,3 @@ } | ||
return; | ||
} | ||
} | ||
else if (self._validateResponse(res, [PACKET_CONF, CRC_CMD, false, false]) && res.length === 4) { | ||
@@ -289,5 +292,5 @@ if (callback) { | ||
}); | ||
} | ||
module.exports = Attiny; | ||
module.exports = Attiny; |
{ | ||
"name": "attiny-common", | ||
"version": "0.0.8", | ||
"version": "0.0.9", | ||
"description": "A common library for Tessel's ATTiny based modules", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22863
476