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.

Counter.h

Committer:
kpan
Date:
2018-11-12
Revision:
0:693f2f97c8c1
Child:
1:e8eeddee2959

File content as of revision 0:693f2f97c8c1:

#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);
};