-
Notifications
You must be signed in to change notification settings - Fork 13
/
nvm.h
35 lines (32 loc) · 966 Bytes
/
nvm.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#define CALIBRATION_VERY_SMALL_SIZE 3
class TestPinCalibration
{
public:
uint16_t resDown;
uint16_t resUp;
uint16_t capOffsetInPf; // when using fast ADC
uint16_t capOffsetHighInPfMu16[CALIBRATION_VERY_SMALL_SIZE]; // when using slow adc
uint16_t inductanceInUF;
TestPinCalibration()
{
resDown=0;
resUp=0;
capOffsetInPf=0;
inductanceInUF=0;
for(int i=0;i<CALIBRATION_VERY_SMALL_SIZE;i++)
capOffsetHighInPfMu16[i]=0.0;
}
};
class NVM
{
public:
static void init();
static bool load();
static bool loadTestPin(int pin, TestPinCalibration &calibration);
static bool saveTestPin(int pin, const TestPinCalibration &calibration);
static bool reset();
static bool doneWriting();
static bool hasCalibration();
protected:
static bool loaded;
};