Simple counter class, non-volatile between resets and power on/off.

Simple Counter class, used to store count array in non-volatile flash memory between resets and power on/off.

Files at this revision

API Documentation at this revision

Comitter:
kpan
Date:
Fri Nov 16 14:52:41 2018 +0000
Parent:
3:c15c22484205
Commit message:
Added decrement and clear functions

Changed in this revision

Counter.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Counter.cpp	Fri Nov 16 14:51:40 2018 +0000
+++ b/Counter.cpp	Fri Nov 16 14:52:41 2018 +0000
@@ -12,7 +12,7 @@
 #ifdef COUNTER_DEBUG
     debug_out.printf("Constructing Object...\r\n");
 #endif
-    memset(&counter, 0, MAX_LEN);
+    memset(&count, 0, MAX_LEN);
     this->init();
 }
 
@@ -91,6 +91,5 @@
     #ifdef COUNTER_DEBUG
         debug_out.printf("Clearing stored values\r\n");
     #endif
-    memset(&counter, 0, MAX_LEN);
-    memwrite();
+    memset(&count, 0, MAX_LEN);
 }
\ No newline at end of file