Skip to content

Commit

Permalink
Merge pull request #15 from TizenTeam/sandbox/rzr/review/master
Browse files Browse the repository at this point in the history
Drop uncritical dependencies to enable alt runtimes
  • Loading branch information
miroRucka authored Sep 7, 2018
2 parents 4e8d0a7 + a1cda14 commit 4eb1d4a
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions bh1750.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
var console = require('console');
var i2c = require('i2c');
var _ = require('lodash');
var utils = require('./utils');

var BH1750 = function (opts) {
this.options = _.extend({}, {
this.options = opts || {
address: 0x23,
device: '/dev/i2c-1',
command: 0x10,
length: 2
}, opts);
};
this.verbose = this.options.verbose || false;
this.wire = new i2c(this.options.address, {device: this.options.device});
};

BH1750.prototype.readLight = function (cb) {
var self = this;
if (!utils.exists(cb)) {
if (!cb) {
throw new Error("Invalid param");
}
self.wire.readBytes(self.options.command, self.options.length, function (err, res) {
if (utils.exists(err)) {

if (err) {
if (self.verbose)
console.error("error: I/O failure on BH1750 - command: ", self.options.command);
return cb(err, null);
Expand Down

0 comments on commit 4eb1d4a

Please sign in to comment.