EEPROM with 64kByte Memory

Revision:
4:660801ce718c
Parent:
3:8a0bfc787463
--- a/AT24C64D.cpp	Fri Mar 01 11:26:26 2019 +0000
+++ b/AT24C64D.cpp	Tue Mar 05 09:44:30 2019 +0000
@@ -28,6 +28,22 @@
 }
 
 
+//******************************************************************************//
+//  Returns the address of the spi bus. This is the combination of the Hardware //
+//  chip address and the user defined addres [A2..A0]                           //
+//******************************************************************************//
+uint8_t AT24C64D::getAddrBus(){
+    return AT24C64D_W;
+}
+
+
+
+//******************************************************************************//
+//  Returns the user defined address [A2..A0]                                   //
+//******************************************************************************//
+uint8_t AT24C64D::getAddrUser(){
+    return (AT24C64D_W >> 1) & USER_ADDR_MASK;
+}
 
 //******************************************************************************//
 //  Sets the address for the writing position. If the address is higher as the  //
@@ -131,7 +147,7 @@
 // not implemented
 /******************************************************************************/
 bool  AT24C64D::erase(){
-    return ACK;
+    return NACK;
 }
 
 
@@ -160,8 +176,6 @@
     while(not isReady());
     ACKpolling(AT24C64D_W);
     
-//    printf("TimeOut: %d\n", uiTimeOut);
-    
     uiAddr      = uiAddr & ADDR_MASK;            
     cBuffer[0]  = (uiAddr >> 8) & 0xFF;
     cBuffer[1]  = uiAddr & 0xFF;
@@ -174,7 +188,7 @@
     
     
     uiAddrWrite = uiAddr;
-    incAddrWrite();
+    //incAddrWrite();
     
     return bAck;
 }
@@ -196,16 +210,7 @@
 //
 //******************************************************************************//
 bool AT24C64D::read(char *cData){ 
-
-    //bAck = ACKpolling(AT24C64D_R);                                              // polling for ACK
-    
-    //if(bAck == ACK){        
-        i2c->start();                                                           // send a start condition
-        i2c->write(AT24C64D_R);
-        *cData = i2c->read(false);
-        i2c->stop();
-    //}
-    return bAck;
+    return read(uiAddrRead, cData);
 }