DS1307 RTC programming - 2. Using the 56 nvSRAM bytes

The DS1307 comes with 56 bytes of nvSRAM.

If you remove the battery this sRAM dies. However it is 56 bytes that survive a power off when used
with an Arduino so almost as good as the EEPROM. Here are the Read and Write for anyone who cares.

void Tiny_RTC_DS1307_24C32::ReadSRAMByte(byte bAddress, byte *pbValue)
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(bAddress+8);
  Wire.endTransmission();
  uint8_t bRet = Wire.requestFrom(DS1307_I2C_ADDRESS, 1);
  *pbValue = Wire.read();
}

void Tiny_RTC_DS1307_24C32::WriteSRAMByte(byte bAddress, byte bValue)
{
  Wire.beginTransmission(DS1307_I2C_ADDRESS);
  Wire.write(bAddress+8);
  Wire.write(bValue);
  Wire.endTransmission();
}

Thanks for sharing. For those who want to better understand what akis_t has provided, see the Timekeeper Register, Table 2 on page 8 of:

http://datasheets.maximintegrated.com/en/ds/DS1307.pdf