upm  1.7.1
Sensor/Actuator repository for libmraa (v2.0.0)
dfrec.hpp
1 /*
2  * Author: Jon Trulson <jtrulson@ics.com>
3  * Copyright (c) 2016 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 #pragma once
25 
26 #include <string>
27 #include <iostream>
28 
29 #include <stdlib.h>
30 #include <unistd.h>
31 #include <string.h>
32 
33 #include "dfrec.h"
34 
35 namespace upm {
68  class DFREC {
69  public:
70 
83  DFREC(unsigned int apin, unsigned int uart_ow,
84  unsigned int device_idx,
85  float a_ref);
86 
90  ~DFREC();
91 
97  void update();
98 
105  void setOffset(float offset);
106 
113  void setScale(float scale);
114 
121  float getEC();
122 
129  float getVolts();
130 
137  float getNormalized();
138 
145  float getTemperature();
146 
154  void setThresholdMinMax(float min, float max);
155 
163  void setThreshold1(float thres, float scale, float offset);
164 
172  void setThreshold2(float thres, float scale, float offset);
173 
180  void setThreshold3(float scale, float offset);
181 
182  protected:
183  // dfrec device context
184  dfrec_context m_dfrec;
185 
186  private:
187  /* Disable implicit copy and assignment operators */
188  DFREC(const DFREC&) = delete;
189  DFREC &operator=(const DFREC&) = delete;
190  };
191 }
DFREC(unsigned int apin, unsigned int uart_ow, unsigned int device_idx, float a_ref)
Definition: dfrec.cxx:34
void setThreshold2(float thres, float scale, float offset)
Definition: dfrec.cxx:101
void update()
Definition: dfrec.cxx:48
float getNormalized()
Definition: dfrec.cxx:81
void setThresholdMinMax(float min, float max)
Definition: dfrec.cxx:91
Definition: dfrec.h:48
~DFREC()
Definition: dfrec.cxx:44
C++ API wrapper for the bh1749 driver.
Definition: a110x.hpp:29
float getVolts()
Definition: dfrec.cxx:76
float getTemperature()
Definition: dfrec.cxx:86
void setThreshold3(float scale, float offset)
Definition: dfrec.cxx:106
void setScale(float scale)
Definition: dfrec.cxx:66
void setThreshold1(float thres, float scale, float offset)
Definition: dfrec.cxx:96
float getEC()
Definition: dfrec.cxx:71
C API for the DFRobot EC Meter.
DFRobot EC Meter.
Definition: dfrec.hpp:68
void setOffset(float offset)
Definition: dfrec.cxx:61