mirror of
https://github.com/eclipse/upm.git
synced 2025-07-01 01:11:10 +03:00
upmc: Updates for building C modules w/base UPM
Test commit for building C UPM modules. * Added C include directory * Added C utilities directory * Rename C++ upm.h -> upm.hpp to make room for C upm.h * Added upm_mixed_module_init function to src/CMakeLists.txt. This function takes filesnames similar to upm_module_init and does a bit of processing before calling upm_module_init. * Added c example directory. Changed c++ example names. * Added dfrph implemention for testing (C++ wraps C). Added mraa to .pc requires for dfrph. Tested against stand-alone project. Added dfrph c example. * Update implemention of pkg-config file generation. * Added two cmake cache variables: BUILDCPP and BUILDFTI * Removed src from swig_add_module calls, added libname to swig_link_libraries calls. Shrinks swig'ed binaries by ~13%. * Added install target in upm/CMakeLists.txt to install C header, directory. Is this where we want this? * C FTI header directory is include/fti Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
@ -25,7 +25,8 @@
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <mraa/aio.hpp>
|
||||
|
||||
#include "dfrph.h"
|
||||
|
||||
namespace upm {
|
||||
/**
|
||||
@ -94,22 +95,15 @@ namespace upm {
|
||||
* DFRPH constructor
|
||||
*
|
||||
* @param pin Analog pin to use
|
||||
* @param aref Analog reference voltage; default is 5.0 V
|
||||
* @param vref Analog reference voltage; default is 5.0 V
|
||||
*/
|
||||
DFRPH(int pin, float aref=5.0);
|
||||
DFRPH(int pin, float vref = 5.0);
|
||||
|
||||
/**
|
||||
* DFRPH destructor
|
||||
*/
|
||||
~DFRPH();
|
||||
|
||||
/**
|
||||
* Returns the voltage detected on the analog pin
|
||||
*
|
||||
* @return The detected voltage
|
||||
*/
|
||||
float volts();
|
||||
|
||||
/**
|
||||
* Specifies the offset determined from calibration. The default
|
||||
* is 0.0.
|
||||
@ -118,6 +112,16 @@ namespace upm {
|
||||
*/
|
||||
void setOffset(float offset);
|
||||
|
||||
/**
|
||||
* Specifies the scale determined from calibration. The default
|
||||
* is 1.0.
|
||||
*
|
||||
* @param scale The scale value to use
|
||||
*/
|
||||
void setScale(float scale);
|
||||
|
||||
float volts();
|
||||
|
||||
/**
|
||||
* Take a number of samples and return the detected pH value. The
|
||||
* default number of samples is 15.
|
||||
@ -125,18 +129,10 @@ namespace upm {
|
||||
* @param samples The number of samples to average over, default 15
|
||||
* @return The pH value detected
|
||||
*/
|
||||
float pH(unsigned int samples=15);
|
||||
|
||||
protected:
|
||||
mraa::Aio m_aio;
|
||||
float pH(unsigned int samples = 15);
|
||||
|
||||
private:
|
||||
float m_aref;
|
||||
// ADC resolution
|
||||
int m_aRes;
|
||||
|
||||
// voltage offset
|
||||
float m_offset;
|
||||
dfrph_context _dev;
|
||||
};
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user