mirror of
https://github.com/eclipse/upm.git
synced 2025-07-26 21:51:16 +03:00
Added iGas interface
Signed-off-by: Serban Waltter <serban.waltter@rinftech.com> Signed-off-by: Mihai Tudor Panu <mihai.tudor.panu@intel.com>
This commit is contained in:

committed by
Mihai Tudor Panu

parent
f28a6d2561
commit
e4f106a0c7
@ -4,5 +4,6 @@ upm_mixed_module_init (NAME gas
|
||||
C_SRC mqx.c
|
||||
CPP_HDR gas.hpp mq2.hpp mq3.hpp mq4.hpp mq5.hpp mq6.hpp mq7.hpp mq8.hpp mq9.hpp tp401.hpp
|
||||
CPP_SRC gas.cxx mq2.cxx mq3.cxx mq4.cxx mq5.cxx mq6.cxx mq7.cxx mq8.cxx mq9.cxx tp401.cxx
|
||||
IFACE_HDR iGas.hpp
|
||||
FTI_SRC mqx_fti.c
|
||||
REQUIRES mraa)
|
||||
|
@ -89,6 +89,11 @@ Gas::getSample () {
|
||||
return m_aio.read();
|
||||
}
|
||||
|
||||
float
|
||||
Gas::getConcentration() {
|
||||
return m_aio.read();
|
||||
}
|
||||
|
||||
void
|
||||
Gas::printGraph (thresholdContext* ctx, uint8_t resolution) {
|
||||
std::cout << "(" << ctx->runningAverage << ") | ";
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <mraa/aio.hpp>
|
||||
#include <interfaces/iGas.hpp>
|
||||
|
||||
struct thresholdContext {
|
||||
long averageReading;
|
||||
@ -42,7 +43,7 @@ namespace upm {
|
||||
* @defgroup gas libupm-gas
|
||||
* @ingroup seeed analog gaseous eak hak
|
||||
*/
|
||||
class Gas {
|
||||
class Gas: virtual public iGas {
|
||||
public:
|
||||
/**
|
||||
* Instantiates a Gas object
|
||||
@ -89,6 +90,11 @@ class Gas {
|
||||
*/
|
||||
virtual int getSample ();
|
||||
|
||||
/**
|
||||
* Returns one sample from the sensor
|
||||
*/
|
||||
virtual float getConcentration ();
|
||||
|
||||
/**
|
||||
*
|
||||
* Prints a running average of the threshold context
|
||||
|
@ -1,7 +1,17 @@
|
||||
#ifdef SWIGPYTHON
|
||||
%module (package="upm") cwlsxxa
|
||||
#endif
|
||||
|
||||
%import "interfaces/interfaces.i"
|
||||
|
||||
%include "../common_top.i"
|
||||
|
||||
/* BEGIN Java syntax ------------------------------------------------------- */
|
||||
#ifdef SWIGJAVA
|
||||
%typemap(javaimports) SWIGTYPE %{
|
||||
import upm_interfaces.*;
|
||||
%}
|
||||
|
||||
%typemap(jni) (uint16_t *buffer, int len) "jshortArray";
|
||||
%typemap(jtype) (uint16_t *buffer, int len) "short[]";
|
||||
%typemap(jstype) (uint16_t *buffer, int len) "short[]";
|
||||
|
Reference in New Issue
Block a user