-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMCP3428.h
More file actions
executable file
·36 lines (31 loc) · 1.15 KB
/
MCP3428.h
File metadata and controls
executable file
·36 lines (31 loc) · 1.15 KB
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
/****************************************************************************
Distributed with a free-will license.
Use it any way you want, profit or free, provided it fits in the licenses of its associated works.
MCP3428
This code is designed to work with the MCP3428_I2CADC I2C Mini Module available from ControlEverything.com.
https://www.controleverything.com/content/Analog-Digital-Converters?sku=MCP3428_I2CADC#tabs-0-product_tabset-2
****************************************************************************/
#include <Wire.h>
#include <math.h>
class MCP3428
{
public:
MCP3428(uint8_t i2cAddress);
~MCP3428();
bool testConnection(void);
void SetConfiguration(uint8_t channel, uint8_t resolution, bool mode, uint8_t PGA);
bool CheckConversion();
long readADC();
private:
unsigned long getConversionTime(uint8_t resolution);
uint8_t devAddr;
long raw_adc;
uint8_t SPS;
bool MODE;
uint8_t i;
uint8_t testvar;
uint8_t config;
uint8_t GAIN;
uint8_t no_of_bytes;
uint8_t data[3];
};