Skip to content

Commit

Permalink
LCD: Fix i2cConfig address forwarding for JHD1313M1 controller
Browse files Browse the repository at this point in the history
Signed-off-by: Rick Waldron <[email protected]>
  • Loading branch information
rwaldron committed Apr 17, 2016
1 parent e206d97 commit d56ff54
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
15 changes: 9 additions & 6 deletions lib/lcd.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,22 @@ var Controllers = {
initialize: {
value: function(opts) {

// LCD: 0x3E
// RGB: 0x62
this.address = {
lcd: opts.address || 0x3E,
rgb: 0x62
};

opts.address = this.address;

this.io.i2cConfig(opts);

this.lines = opts.lines || 2;
this.rows = opts.rows || 2;
this.cols = opts.cols || 16;
this.dots = opts.dots || "5x8";

// LCD: 0x3E
// RGB: 0x62
this.address = {
lcd: opts.address || 0x3E,
rgb: 0x62
};

var display = this.OP.DISPLAY | this.OP.DISPLAYON | this.OP.CURSOROFF | this.OP.BLINKOFF;

Expand Down
4 changes: 3 additions & 1 deletion test/lcd.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,9 @@ exports["LCD - I2C (JHD1313M1)"] = {
var forwarded = this.i2cConfig.lastCall.args[0];

test.equal(this.i2cConfig.callCount, 1);
test.equal(forwarded.address, 0xff);
// This controller will actually forward 2 addresses
// as an object of addresses.
test.deepEqual(forwarded.address, { lcd: 0xff, rgb: 0x62 });
test.equal(forwarded.bus, "i2c-1");

test.done();
Expand Down

0 comments on commit d56ff54

Please sign in to comment.