-
Notifications
You must be signed in to change notification settings - Fork 0
/
ResistorMeasureBoard.h
87 lines (66 loc) · 1.71 KB
/
ResistorMeasureBoard.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef __RESISTOR_MEASURE_BOARD_H__
#define __RESISTOR_MEASURE_BOARD_H__
#include "Arduino.h"
#include "Adafruit_ADS1015.h"
#define I2C_ADDRESS_MUX 0x20
#define I2C_ADDRESS_ADC 0x48
#define REFERENCE_RESISTOR_PT100 100.0
#define REFERENCE_RESISTOR_NTC 100000.0
typedef struct {
double iRef;
double uRef;
double uRx;
double rx;
double uOut;
int uOutRangemv;
int uRefRangemv;
int uRxRangemv;
bool error;
} CHANNEL_DATA_T;
class RTDBoard {
protected:
static int GAIN_VOLTAGE[];
static adsGain_t GAIN_REGISTER[];
static int MAX_GAIN_NUMBER;
static double MIN_UREF_VOLTAGE;
static double A;
static double B;
int CHANNEL_COUNT;
double REFERENCE_RESISTOR_VALUE;
Adafruit_ADS1115 adc = Adafruit_ADS1115(I2C_ADDRESS_ADC);
CHANNEL_DATA_T data[8];
double readAdcUOut_AutoGain();
double readAdcUref_AutoGain();
double readAdcUrx_AutoGain();
public:
RTDBoard(double reference,int maxChannel);
void begin();
virtual void readAllValues(int channel);
virtual void readAllValues();
String toString();
inline float getIref(int index) {
return data[index].iRef;
}
inline float getUref(int index) {
return data[index].uRef;
}
inline float getUrx(int index) {
return data[index].uRx;
}
inline float getRx(int index) {
return data[index].rx;
}
inline float getUout(int index) {
return data[index].uOut;
}
inline float getUrefRangemv(int index) {
return data[index].uRefRangemv;
}
inline float getUrxRangemv(int index) {
return data[index].uRxRangemv;
}
inline bool getError(int index) {
return data[index].error;
}
};
#endif