-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathads12xx.h
78 lines (64 loc) · 1.06 KB
/
ads12xx.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
#ifndef ads12xx_H
#define ads12xx_H
// mod for multiple ADCs J.Beale 14-Sept-2019
//#define ADS1248
#define ADS1256
/*Serial Template */
#ifdef ADS1248
#include "ads1248.h"
#endif // ADS1248
#ifdef ADS1256
#include "ads1256.h"
#endif // ADS1256
#include "SPI.h"
class ads12xx {
public:
ads12xx();
void begin(
int CS,
int START,
int DRDY,
int _RESET
);
void Reset(
);
unsigned long GetRegisterValue(
uint8_t regAdress
);
void SendCMD(
uint8_t cmd
);
void SetRegisterValue(
uint8_t regAdress,
uint8_t regValue
);
bool waitforDRDY(
int rdy
);
struct regValues_t
{
#ifdef ADS1248
uint8_t MUX0_val;
uint8_t VBIAS_val;
uint8_t MUX1_val;
uint8_t SYS0_val;
uint8_t IDAC0_val;
uint8_t IDAC1_val;
#endif // ADS1248
#ifdef ADS1256
uint8_t STATUS_val = STATUS_RESET;
uint8_t MUX_val = MUX_RESET;
uint8_t ADCON_val = ADCON_RESET;
uint8_t DRATE_val = DRATE_RESET;
uint8_t IO_val = IO_RESET;
#endif // ADS1256
};
long GetConversion(
);
private:
int _CS;
int _DRDY;
int _START;
// volatile int DRDY_state;
};
#endif