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.

Committer:
kpan
Date:
Mon Nov 12 18:43:22 2018 +0000
Revision:
0:693f2f97c8c1
Child:
1:e8eeddee2959
Initial Commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kpan 0:693f2f97c8c1 1 #include "mbed.h"
kpan 0:693f2f97c8c1 2 #include "FreescaleIAP.h"
kpan 0:693f2f97c8c1 3 #define PARTY_LIMIT 8
kpan 0:693f2f97c8c1 4
kpan 0:693f2f97c8c1 5 #define COUNTER_DEBUG
kpan 0:693f2f97c8c1 6
kpan 0:693f2f97c8c1 7 class Counter
kpan 0:693f2f97c8c1 8 {
kpan 0:693f2f97c8c1 9 private:
kpan 0:693f2f97c8c1 10 int vc[PARTY_LIMIT];
kpan 0:693f2f97c8c1 11 int is_written;
kpan 0:693f2f97c8c1 12 int address;
kpan 0:693f2f97c8c1 13 void print_memory();
kpan 0:693f2f97c8c1 14 void init();
kpan 0:693f2f97c8c1 15 public:
kpan 0:693f2f97c8c1 16 Counter();
kpan 0:693f2f97c8c1 17 void write_vc();
kpan 0:693f2f97c8c1 18 void read_vc();
kpan 0:693f2f97c8c1 19 void increment(int);
kpan 0:693f2f97c8c1 20 };