Skip to content

Commit

Permalink
set command and data hex from options
Browse files Browse the repository at this point in the history
  • Loading branch information
rudacs committed Oct 2, 2017
1 parent e1e0edb commit 644948d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions oled.js
Expand Up @@ -7,6 +7,8 @@ var Oled = function(board, five, opts) {
this.MICROVIEW = opts.microview || false;
this.SLAVEPIN = opts.slavePin || 12;
this.RESETPIN = opts.resetPin || 4;
this.DATA = opts.data || 0x40;
this.COMMAND = opts.command || 0x00;

// create command buffers
this.DISPLAY_OFF = 0xAE;
Expand Down Expand Up @@ -168,9 +170,9 @@ Oled.prototype._setUpI2C = function(opts) {
Oled.prototype._transfer = function(type, val) {
var control;
if (type === 'data') {
control = 0x40;
control = this.DATA;
} else if (type === 'cmd') {
control = 0x80;
control = this.COMMAND;
} else {
return;
}
Expand Down Expand Up @@ -593,7 +595,7 @@ Oled.prototype.drawLine = function(x0, y0, x1, y1, color, sync) {
// Draw an outlined rectangle
Oled.prototype.drawRect = function(x, y, w, h, color, sync){
var immed = (typeof sync === 'undefined') ? true : sync;
//top
//top
this.drawLine(x, y, x + w, y,color,false);

//left
Expand Down

0 comments on commit 644948d

Please sign in to comment.