upm  0.1.8
Sensor/Actuator repository for libmraa (v0.4.5)
 All Data Structures Files Functions Variables Macros Pages
Public Member Functions | Protected Attributes
Gas Class Reference

C++ API for Gas sensors. More...

Detailed Description

This file defines the Gas Analog sensors virtual functions

Public Member Functions

 Gas (int gasPin)
 
 ~Gas ()
 
virtual int getSampledWindow (unsigned int freqMS, unsigned int numberOfSamples, uint16_t *buffer)
 
virtual int findThreshold (thresholdContext *ctx, unsigned int threshold, uint16_t *buffer, unsigned int len)
 
virtual int getSampledData (thresholdContext *ctx)
 
virtual int getSample (thresholdContext *ctx)
 
virtual void printGraph (thresholdContext *ctx, uint8_t resolution)
 

Protected Attributes

mraa_aio_context m_gasCtx
 

Constructor & Destructor Documentation

Gas ( int  gasPin)

Instanciates a Gas object

Parameters
gasPinpin where gas is connected
~Gas ( )

Gas object destructor

Member Function Documentation

int getSampledWindow ( unsigned int  freqMS,
unsigned int  numberOfSamples,
uint16_t *  buffer 
)
virtual

Get samples from gas sensor according to provided window and number of samples

Parameters
freqMStime between each sample (in microseconds)
numberOfSamplesnumber of sample to sample for this window
bufferbufer with sampled data
int findThreshold ( thresholdContext ctx,
unsigned int  threshold,
uint16_t *  buffer,
unsigned int  len 
)
virtual

Given sampled buffer this method will return TRUE/FALSE if threshold was reached

Parameters
ctxthreshold context
thresholdsample threshold
bufferbuffer with samples
lenbufer len
int getSampledData ( thresholdContext ctx)
virtual

Return avarage data for the sampled window

Parameters
ctxthreshold context
int getSample ( thresholdContext ctx)
virtual

Return one sample from the sensor

Parameters
ctxthreshold context
void printGraph ( thresholdContext ctx,
uint8_t  resolution 
)
virtual

Print running average of threshold context

Parameters
ctxthreshold context
Inheritance diagram for Gas:
Inheritance graph
[legend]

The documentation for this class was generated from the following files: