Mirror with some correction

Dependencies:   mbed FastIO FastPWM USBDevice

Revision:
79:682ae3171a08
Parent:
76:7f5912b6340e
--- a/nvm.h	Sun Mar 19 05:30:53 2017 +0000
+++ b/nvm.h	Thu Mar 23 05:19:05 2017 +0000
@@ -42,8 +42,9 @@
                 && checksum == CRC32(&d, sizeof(d)));
     }
     
-    // save to non-volatile memory
-    void save(FreescaleIAP &iap, int addr)
+    // Save to non-volatile memory.  Returns true on success, false
+    // if an error code is returned from the flash programmer.
+    bool save(FreescaleIAP &iap, int addr)
     {
         // update the checksum and structure size
         d.sig = SIGNATURE;
@@ -52,13 +53,7 @@
         checksum = CRC32(&d, sizeof(d));
         
         // save the data to flash
-        iap.program_flash(addr, this, sizeof(*this));
-    }
-    
-    // verify that the NVM matches the in-memory configuration
-    bool verify(int addr)
-    {
-        return memcmp((NVM *)addr, this, sizeof(*this)) == 0;
+        return iap.programFlash(addr, this, sizeof(*this)) == FreescaleIAP::Success;
     }
     
     // stored data (excluding the checksum)