eightbyeight
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -22,2 +22,5 @@ var i2c = require('i2c'); | ||
// transaction level | ||
this.transactionLevel = 0; | ||
// Turn the oscillator on | ||
@@ -46,7 +49,8 @@ this.wire.writeBytes(__HT16K33_REGISTER_SYSTEM_SETUP | 0x01, [0x00]) | ||
LEDBackpack.prototype.setBufferRow = function(row, value, update){ | ||
if (update !== false) update = true | ||
LEDBackpack.prototype.setBufferRow = function(row, value){ | ||
if (row < 0 || row > 7) return | ||
this.buffer[row] = value // value # & 0xFFFF | ||
if (update) this.writeDisplay() | ||
if (this.transactionLevel === 0) { | ||
this.writeDisplay() | ||
} | ||
} | ||
@@ -72,8 +76,20 @@ | ||
LEDBackpack.prototype.clear = function(update){ | ||
if (update !== false) update = true | ||
LEDBackpack.prototype.clear = function(){ | ||
this.buffer = [ 0, 0, 0, 0, 0, 0, 0, 0 ] | ||
if (update) this.writeDisplay() | ||
if (this.transactionLevel === 0) { | ||
this.writeDisplay() | ||
} | ||
} | ||
LEDBackpack.prototype.startTransaction = function(){ | ||
this.transactionLevel++; | ||
} | ||
LEDBackpack.prototype.commitTransaction = function(){ | ||
this.transactionLevel--; | ||
if (transactionLevel === 0) { | ||
this.writeDisplay() | ||
} | ||
} | ||
module.exports = LEDBackpack |
{ | ||
"name": "eightbyeight", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Node library for Adafruit 8x8 LED Matrix", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
4738
97