Test Program for AT241024. Byte R/W, Page R/W

Dependencies:   AT24C1024 mbed-rtos mbed

Revision:
4:015c1e2a3ae2
Parent:
3:2265ade869a4
--- a/main.cpp	Tue Jan 03 09:04:39 2017 +0000
+++ b/main.cpp	Fri Jan 06 08:33:50 2017 +0000
@@ -35,12 +35,31 @@
     // Page Read/Write
     // 
     uint8_t eep_buf[258], r_eep_buf[258];
+    
+    // Zero Clear
+    for (int i = 0; i < 256; i++) {
+        eep_buf[i] = 0;
+        r_eep_buf[i] = 0xff;
+    }
+    printf("Page Write: Zero Clear\r\n");
+    AT24C_STATUS status = at24c1024.write_page(0x1ff00, eep_buf, sizeof(eep_buf));
+    wait_ms(5);
+    printf("Status: %d\r\n", status);
+    printf("Page Read:\r\n");
+    status = at24c1024.read_page(0x1ff00, r_eep_buf, sizeof(r_eep_buf));
+    printf("Status: %d\r\n", status);
+    for (int i = 0; i < sizeof(r_eep_buf); i++) {
+        printf("%d ", r_eep_buf[i]);
+    }
+    printf("\r\n");
+    
+    // Set 0..255
     for (int i = 0; i < 256; i++) {
         eep_buf[i] = i;
         r_eep_buf[i] = 0x00;
     }
     printf("Page Write: 0..255\r\n");
-    AT24C_STATUS status = at24c1024.write_page(0x1ff00, eep_buf, sizeof(eep_buf));
+    status = at24c1024.write_page(0x1ff00, eep_buf, sizeof(eep_buf));
     wait_ms(5);
     printf("Status: %d\r\n", status);
     printf("Page Read:\r\n");