upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
ads1115.hpp
1 /*
2  * Author: Marc Graham <marc@m2ag.net>
3  * Copyright (c) 2015 Intel Corporation.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining
6  * a copy of this software and associated documentation files (the
7  * "Software"), to deal in the Software without restriction, including
8  * without limitation the rights to use, copy, modify, merge, publish,
9  * distribute, sublicense, and/or sell copies of the Software, and to
10  * permit persons to whom the Software is furnished to do so, subject to
11  * the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be
14  * included in all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23  */
24 /*=========================================================================*/
25 
26 #pragma once
27 
28 #include "ads1x15.hpp"
29 
30 
31 
32 /*=========================================================================
33  CONVERSION DELAY (in microS)
34  -----------------------------------------------------------------------*/
35  #define ADS1115_CONVERSIONDELAY (8000)
36 /*=========================================================================*/
37 
38 
39 /*=========================================================================
40  CONFIG REGISTER
41 
42  -----------------------------------------------------------------------*/
43 
44 #define ADS1115_DR_MASK (0x00E0)
45 #define ADS1115_DR_8SPS (0x0000) // 8 samples per second
46 #define ADS1115_DR_16SPS (0x0020) // 16 samples per second
47 #define ADS1115_DR_32SPS (0x0040) // 32 samples per second
48 #define ADS1115_DR_64SPS (0x0060) // 64 samples per second
49 #define ADS1115_DR_128SPS (0x0080) // 128 samples per second (default)
50 #define ADS1115_DR_250SPS (0x00A0) // 250 samples per second
51 #define ADS1115_DR_475SPS (0x00C0) // 475 samples per second
52 #define ADS1115_DR_860SPS (0x00E0) // 860 samples per second
53 
54 /*=========================================================================*/
55 
56 namespace upm {
86  class ADS1115 : public ADS1X15 {
87 
88  public:
89 
104  typedef enum ADSDATARATE
105  {
106  SPS_8 = ADS1115_DR_8SPS,
107  SPS_16 = ADS1115_DR_16SPS,
108  SPS_32 = ADS1115_DR_32SPS,
109  SPS_64 = ADS1115_DR_64SPS,
110  SPS_128 = ADS1115_DR_128SPS,
111  SPS_250 = ADS1115_DR_250SPS,
112  SPS_475 = ADS1115_DR_475SPS,
113  SPS_860 = ADS1115_DR_860SPS
114  } ADSDATARATE;
115 
116 
117 
124  ADS1115 (int bus, uint8_t address = 0x48);
125 
129  ~ADS1115();
130 
138  void setSPS(ADSDATARATE rate = ADS1115::SPS_128);
139 
140 
141  protected:
142  float getMultiplier(void);
143  void setDelay(void);
144 
145  };
146 }
~ADS1115()
Definition: ads1115.cxx:35
Definition: ads1x15.hpp:113
void setSPS(ADSDATARATE rate=ADS1115::SPS_128)
Definition: ads1115.cxx:38
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
API for ADS1115.
Definition: ads1115.hpp:86
ADS1115(int bus, uint8_t address=0x48)
Definition: ads1115.cxx:28