M24512 EEPROM Driver. The main purpose of this library is to make memory reading and writing in applications agnostic to the page boundaries.

Homepage

Driver class for the ST M24512.

ST 64 KiB I2C EEPROM

The main purpose of this library is to make EEPROM memory reading and writing in applications agnostic to the page boundaries.
This means that reading or writing large buffers from any starting address is easier for the program as it's not required to know the page size.

It is possible to read and write the full size of the EEPROM in one call as the library handles the page counting internally.

Quote:

The driver can be turned into template wrapper class for other EEPROMs without much effort.

// Example writing  5000 bytes

 #include "M24512.h"
 
 M24512 eeprom(I2C_SDA, I2C_SCL);
 char data[5000] ;

 int main() {
    M24512::status_t ret;

    printf("Total memory size: %lu KiB\n", eeprom.get_total_memory() );

    ret = eeprom.write(0, data,  sizeof(data) );
    if ( ret != M24512::M24512_SUCCESS  )
    {
        printf("Error writing this! %2.2X\n", ret );
    }
 
    memset( data, 0, sizeof(data) );
    ret = eeprom.read(0, (char*)&data,   sizeof(data) );
    if ( ret !=  M24512::M24512_SUCCESS  )
    {
        printf("Error reading %2.2X!\n", ret );
    }

    printf("Read: %s\n", data );
  return 0;
 }

All wikipages