insure export is capital
parent
ee789c9105
commit
25c4cbfba3
|
@ -19,4 +19,6 @@ class Bus {
|
|||
|
||||
} // end of Bus Class
|
||||
|
||||
module.exports = Bus;
|
||||
module.exports = {
|
||||
Bus
|
||||
};
|
||||
|
|
|
@ -3,22 +3,22 @@
|
|||
// **********************************
|
||||
|
||||
class Device {
|
||||
// bus is i2c-bus bus object
|
||||
// bus is i2c-bus bus object
|
||||
constructor(bus, address, opts) {
|
||||
this.bus = bus.methods // artifact of adapting ic2-bus to class format
|
||||
this.address = address
|
||||
if (opts){
|
||||
if (opts) {
|
||||
this.id = opts.id // must be unique within a bus
|
||||
this.desc = opts.desc
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
readRaw(length,buffer) {
|
||||
readRaw(length, buffer) {
|
||||
return this.bus.i2cRead_p(this.address, length, buffer)
|
||||
}
|
||||
|
||||
writeRaw(length,buffer) {
|
||||
writeRaw(length, buffer) {
|
||||
return this.bus.i2cWrite_p(this.address, length, buffer)
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,6 @@ class Device {
|
|||
return this.bus.writeByte_p(this.address, cmd, byte)
|
||||
}
|
||||
|
||||
|
||||
read2(cmd) {
|
||||
return this.bus.readWord_p(this.address, cmd)
|
||||
}
|
||||
|
@ -40,11 +39,11 @@ class Device {
|
|||
}
|
||||
|
||||
// command with more than two bytes following
|
||||
readBytes(){}
|
||||
writeBytes(){}
|
||||
readBytes() {}
|
||||
writeBytes() {}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
module.exports = Device;
|
||||
module.exports = {
|
||||
Device
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue