grovepi/Software/NodeJS/libs/sensors/rtcI2cSensor.js
2025-03-21 16:04:17 +01:00

20 lines
No EOL
544 B
JavaScript

var I2cSensor = require('./base/i2cSensor')
var commands = require('../commands')
function RtcI2cSensor() {
I2cSensor.apply(this, Array.prototype.slice.call(arguments))
}
RtcI2cSensor.prototype = new I2cSensor()
RtcI2cSensor.prototype.read = function() {
var write = this.board.writeBytes(commands.rtc_getTime.concat([commands.unused, commands.unused, commands.unused]))
if (write) {
this.board.wait(100)
this.board.readByte()
return this.board.readBytes()
} else {
return false
}
}
module.exports = RtcI2cSensor