AT24C1024B I2C Memory

Hello all,

I am trying to make a library for AT24C1024B I2C Memory but i also want to use this “fast wire” library to communicate with ADXL345, HMC5843 and ITG3200 from a 9DOF Stick.
The main purpose is to have 2 or more instances defined and set for each instance the address R/W as 16/8 bits and use as less memory as possible.

I will need help on two things:

  1. At this moment the functions for reading the integers returns only the first byte of the integer. I don’t know how to solve this…so i need suggestions

  2. Optimize the library for memory consumption.

code that i use to test

#include <GVIWire.h>
GVIWire newI2C(0x56, 1);
char *str = "0A1B2C3D4E";
byte buf[11] = {0};
uint8_t err;
unsigned long i, j, old, ra;
void setup()
        err = newI2C.writeInt(ra, 5555);
        if(err) {Serial.print("ErrW");Serial.println(err);}
        err = newI2C.readInt(ra);
        if(err) {Serial.print("ErrR");Serial.println(err);}
//	old = micros();
//	err = newI2C.writeString(ra, str, strlen(str));
//	j = micros()-old;
//	Serial.println(j);
//	if(err) {Serial.print("ErrW");Serial.println(err);}
//	old = micros();
//	err = newI2C.readString(ra, buf, strlen(str));
//	j = micros()-old;
//	Serial.println(j);
//	if(err) {Serial.print("ErrR");Serial.println(err);}
//	Serial.println((char *)buf);

void loop()
} (3.67 KB)


I have improved the library AT24C1024B I2C Memory and also added a new one for 25LC1024 SPI memory.
In the archive are also the lib needed for memories.
Works only for ATMega328 to make it faster for my needs.

try them and make suggestions (9.39 KB)