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.
Diff: Counter.h
- Revision:
- 0:693f2f97c8c1
- Child:
- 1:e8eeddee2959
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Counter.h Mon Nov 12 18:43:22 2018 +0000 @@ -0,0 +1,20 @@ +#include "mbed.h" +#include "FreescaleIAP.h" +#define PARTY_LIMIT 8 + +#define COUNTER_DEBUG + +class Counter +{ +private: + int vc[PARTY_LIMIT]; + int is_written; + int address; + void print_memory(); + void init(); +public: + Counter(); + void write_vc(); + void read_vc(); + void increment(int); +}; \ No newline at end of file