Grove Air Quality Sensor.

Fork of Grove_Air_Quality_Sensor_Library by Seeed

Air_Quality.h

Committer:
lucian@192-168-0-106.rdsnet.ro
Date:
2016-12-23
Revision:
3:c25365a52d78
Parent:
2:95009177a860
Child:
4:0ca4a9fd1b5d

File content as of revision 3:c25365a52d78:

/*
  AirQuality library v1.0
  2010 Copyright (c) Seeed Technology Inc.  All right reserved.

  Original Author: Bruce.Qin

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#ifndef __AIRQUALITY_H__
#define __AIRQUALITY_H__

#include "mbed.h"
#include "mbed_debug.h"

#ifndef DEBUG_AIR_QUALITY
#define DEBUG_AIR_QUALITY 0
#endif

enum air_quality_values {
    UNKNOWN = -1,
    VERY_HIGH_POLLUTION = 0,
    HIGH_POLLUTION = 1,
    LOW_POLLUTION = 2,
    NO_POLLUTION = 3
};

class AirQuality {
public:
    int i;
    long standard_vol;
    uint16_t init_voltage;
    uint16_t first_vol;
    uint16_t  last_vol;
    int temp;
    bool timer_index;
    bool error;

    void init(PinName pin);

    air_quality_values slope(void);

private:
    PinName _pin;

    void avgVoltage(void);
};

#endif