I bought this Real Time Clock from pimoroni (U126) and it is cheap, but the data sheet is in Chinese. I can find example code for the arduino (M5_BM8563/M5_BM8563.cpp at master · m5stack/M5_BM8563 · GitHub) and can successfully read date and time from it, but do not seem to be able to write to the device to update the time.
The cpp code on the arduino to write is this:
void BM8563::writeReg(uint8_t reg, uint8_t data) {
_wire->beginTransmission(0x51);
_wire->write(reg);
_wire->write(data);
_wire->endTransmission();
}
My pigpio (pigpio library) code (actually pigpioj) looks like this:
err = pigpio.i2cWriteByteData( handle, reg, data );
note I write and read each data item to/from the same address. I read somewhere that this might not be the right thing to do, but they are meant to be even/odd addresses if that is the case…
Any guidance greatly appreciated
P