24LCXXX I2C eeprom library

Dependents:   flw

Fork of _24LCXXX by Hiroshi M

Files at this revision

API Documentation at this revision

Comitter:
Backstrom
Date:
Wed Apr 15 02:07:52 2015 +0000
Parent:
2:81497827f2ee
Commit message:
Fixing page write, part2

Changed in this revision

_24LCXXX.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/_24LCXXX.cpp	Thu Feb 26 07:41:08 2015 +0000
+++ b/_24LCXXX.cpp	Wed Apr 15 02:07:52 2015 +0000
@@ -9,10 +9,11 @@
  * Tool Chain   : ????
  *
  * Revision History:
- * When         Who         Description of change
- * -----------  ----------- -----------------------
- * 2015/02/26   Akafugu     Fixing page write
- * 2012/12/06   Hiroshi M   init
+ * When         Who                 Description of change
+ * -----------  ------------------- -----------------------
+ * 2015/04      Akafugu Corporation Fixing page write, part 2
+ * 2015/02/26   Akafugu Corporation Fixing page write
+ * 2012/12/06   Hiroshi M           init
  *****************************************************************************
  *
  * Copyright (C) 2013 Hiroshi M, MIT License
@@ -161,12 +162,13 @@
 {
     int res;
     _i2c->start();
+    _i2c->write(_i2c_address);
     _i2c->write((0xff00 & mem_addr)>>8);        // Write Address High byte set
     _i2c->write(0x00ff & mem_addr);           // Write Address Low  byte set
     for(int i = 0; i < length; i++)
     {
-        res = _i2c->write(data[i]);
-        if(res != 0) break;
+        res = !_i2c->write(data[i]); // return value from write needs to be inverted.
+        if(res != 0) break; // Write unsuccessfull
     }
 
     _i2c->stop();