A library to read and write all 25* serial SPI eeprom devices from Microchip (from 25xx010 to 25xx1024).

Dependents:   RobotRic VITI2_ihm_2

Revision:
2:3a3404dbd3eb
Parent:
1:c29a67c7034d
--- a/Ser25lcxxx.cpp	Thu Feb 03 20:31:08 2011 +0000
+++ b/Ser25lcxxx.cpp	Sat Feb 19 18:29:20 2011 +0000
@@ -1,3 +1,26 @@
+/*
+* Ser25lcxxx library
+* Copyright (c) 2010 Hendrik Lipka
+* 
+* Permission is hereby granted, free of charge, to any person obtaining a copy
+* of this software and associated documentation files (the "Software"), to deal
+* in the Software without restriction, including without limitation the rights
+* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+* copies of the Software, and to permit persons to whom the Software is
+* furnished to do so, subject to the following conditions:
+* 
+* The above copyright notice and this permission notice shall be included in
+* all copies or substantial portions of the Software.
+* 
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+* THE SOFTWARE.
+*/
+
 #include "Ser25lcxxx.h"
 #include "wait_api.h"
 
@@ -115,7 +138,7 @@
         bool b=writePage(_pageSize*pageNum,_pageSize,s);
         delete s;
         return b;
-    } else if (_size<131072) { // everything up to 512k
+    } else {
         _enable->write(0);
         wait_us(1);
         _spi->write(0x42);
@@ -125,20 +148,7 @@
         _enable->write(1);
 
         waitForWrite();
-    } else { // 25xx1024, needs 3 byte address
-        _enable->write(0);
-        wait_us(1);
-        _spi->write(0x42);
-        _spi->write((_pageSize*pageNum)>>16);
-        _spi->write(HIGH(_pageSize*pageNum));
-        _spi->write(LOW(_pageSize*pageNum));
-        wait_us(1);
-        _enable->write(1);
-
-        waitForWrite();
     }
-
-
     return true;
 }