Skip to content

Commit

Permalink
Drop uncritical dependencies to enable alt runtimes
Browse files Browse the repository at this point in the history
Node is still supported, and IoT.js can be ported.

Related links:

https://engineering.upside.com/you-dont-need-lodash-3323ca2cfb4c

https://github.com/rzr/webthing-iotjs

Change-Id: I58c8c5b728ea6cd457e6618c952c0b7c8a406315
Bug: #15
Origin: https://github.com/tizenteam/bh1750/tree/iotjs/master
Signed-off-by: Philippe Coval <philippe.coval@osg.samsung.com>
  • Loading branch information
rzr committed Aug 24, 2018
1 parent 5f1b37d commit a1cda14
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 a1cda14

Please sign in to comment.