BayEOS-Arduino  1.8.0_0.0.4
MCP342x.h
1 
5 // ensure this library description is only included once
6 #ifndef MCP342x_h
7 #define MCP342x_h
8 
9 // include types & constants of Wiring core API
10 #include <Arduino.h>
11 
12 // MCP342x Base Address (0x68 in HEX)
13 #define MCP342x_ADR B01101000
14 
15 // library interface description
16 class MCP342x
17 {
18  public:
22  MCP342x();
23 
24  MCP342x(byte adc_addr);
25 
26 
27  /*
28  * Resets MCP and sets MCP in sleep mode!
29  *
30  */
31  void reset(void);
35  float getData(byte adc_addr);
36  float getData(void);
40  void setConf(uint8_t adc_addr, uint8_t conf);
41  void setConf(uint8_t conf);
62  void setConf(byte adc_addr, byte rdy, byte ch, byte mode, byte rate, byte gain);
63 
64  /*
65  * Only store configuration for rate and gain.
66  * Nothing is send to MCP!
67  */
68  void storeConf(byte rate, byte gain);
69 
70  /*
71  * Trigger conversion for Channel
72  * uses stored configuration
73  */
74  void runADC(byte ch);
75 
76  /*
77  * gives ADC-Time (depends on rate)
78  */
79  int getADCTime(void);
80 
81 
82  private:
83 // void print_binary(byte);
84 // byte confByte;
85 // byte address;
86  byte resolution;
87  byte gain;
88  long zahl;
89  byte output_bcd[5];
90  byte _adr;
91  byte _conf_rg;
92 
93 
94  void readOutputRegister(byte adc_addr);
95 // void saveData(void);
96 };
97 
98 #endif
99 
100 
float getData(byte adc_addr)
Definition: MCP342x.cpp:127
MCP342x()
Definition: MCP342x.cpp:4
void setConf(uint8_t adc_addr, uint8_t conf)
Definition: MCP342x.cpp:91