/* Writes buffer of data to the I2C EEPROM.  */
void eepromWriteBlock(uint8_t *buffer, size_t address, size_t size)
/* Writes buffer of data to the I2C EEPROM.  */
void eepromWriteBlock(uint8_t *buffer, size_t address, size_t size)
{
  uint8_t offset = address % I2C_FLASH_PAGESIZE;
  uint8_t count = I2C_FLASH_PAGESIZE - offset;
  if (size < count) {
    count = size;
  }
  while (count > 0) {
    eepromPageWrite(buffer, address, count);
    eepromWaitEepromStandbyState();
    address += count;
    buffer += count;
    size -= count;
    count = I2C_FLASH_PAGESIZE;
    if (size < I2C_FLASH_PAGESIZE) {
      count = size;
    }
  }
}