upm  1.3.0
Sensor/Actuator repository for libmraa (v1.7.0)
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Public Member Functions | Protected Attributes
Gas Class Reference

Public Member Functions

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

Protected Attributes

mraa::Aio m_aio

Constructor & Destructor Documentation

Gas ( int  gasPin)

Instantiates a Gas object

gasPinPin where gas is connected
~Gas ( )

Gas object destructor

Member Function Documentation

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

Gets samples from the gas sensor according to the provided window and number of samples

freqMSTime between each sample (in milliseconds)
numberOfSamplesNumber of sample to sample for this window
bufferBuffer with sampled data

Here is the call graph for this function:

int findThreshold ( thresholdContext ctx,
unsigned int  threshold,
uint16_t *  buffer,
int  len 

Given the sampled buffer, this method returns TRUE/FALSE if the threshold is reached

ctxThreshold context
thresholdSample threshold
bufferBuffer with samples
lenBuffer length
int getSampledData ( thresholdContext ctx)

Returns average data for the sampled window

ctxThreshold context
int getSample ( )

Returns one sample from the sensor

Here is the caller graph for this function:

void printGraph ( thresholdContext ctx,
uint8_t  resolution 

Prints a running average of the threshold context

ctxThreshold context
Inheritance diagram for Gas:
Inheritance graph

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