Grove Air Quality Sensor.

Fork of Grove_Air_Quality_Sensor_Library by Seeed

Committer:
lucian@192-168-0-106.rdsnet.ro
Date:
Fri Dec 23 22:31:17 2016 +0200
Revision:
3:c25365a52d78
Parent:
2:95009177a860
Child:
4:0ca4a9fd1b5d
IEM-192 Refactor forked lib and our air quality sensor code

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbedAustin 0:885417624ec2 1 /*
mbedAustin 0:885417624ec2 2 AirQuality library v1.0
mbedAustin 0:885417624ec2 3 2010 Copyright (c) Seeed Technology Inc. All right reserved.
mbedAustin 0:885417624ec2 4
mbedAustin 0:885417624ec2 5 Original Author: Bruce.Qin
mbedAustin 0:885417624ec2 6
mbedAustin 0:885417624ec2 7 This library is free software; you can redistribute it and/or
mbedAustin 0:885417624ec2 8 modify it under the terms of the GNU Lesser General Public
mbedAustin 0:885417624ec2 9 License as published by the Free Software Foundation; either
mbedAustin 0:885417624ec2 10 version 2.1 of the License, or (at your option) any later version.
mbedAustin 0:885417624ec2 11
mbedAustin 0:885417624ec2 12 This library is distributed in the hope that it will be useful,
mbedAustin 0:885417624ec2 13 but WITHOUT ANY WARRANTY; without even the implied warranty of
mbedAustin 0:885417624ec2 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
mbedAustin 0:885417624ec2 15 Lesser General Public License for more details.
mbedAustin 0:885417624ec2 16
mbedAustin 0:885417624ec2 17 You should have received a copy of the GNU Lesser General Public
mbedAustin 0:885417624ec2 18 License along with this library; if not, write to the Free Software
mbedAustin 0:885417624ec2 19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
mbedAustin 0:885417624ec2 20 */
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 21 #ifndef __AIRQUALITY_H__
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 22 #define __AIRQUALITY_H__
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 23
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 24 #include "mbed.h"
lucianovici 1:e312d147cadd 25 #include "mbed_debug.h"
lucianovici 1:e312d147cadd 26
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 27 #ifndef DEBUG_AIR_QUALITY
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 28 #define DEBUG_AIR_QUALITY 0
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 29 #endif
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 30
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 31 enum air_quality_values {
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 32 UNKNOWN = -1,
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 33 VERY_HIGH_POLLUTION = 0,
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 34 HIGH_POLLUTION = 1,
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 35 LOW_POLLUTION = 2,
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 36 NO_POLLUTION = 3
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 37 };
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 38
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 39 class AirQuality {
mbedAustin 0:885417624ec2 40 public:
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 41 int i;
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 42 long standard_vol;
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 43 uint16_t init_voltage;
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 44 uint16_t first_vol;
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 45 uint16_t last_vol;
mbedAustin 0:885417624ec2 46 int temp;
mbedAustin 0:885417624ec2 47 bool timer_index;
mbedAustin 0:885417624ec2 48 bool error;
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 49
lucian@192-168-0-106.rdsnet.ro 3:c25365a52d78 50 void init(PinName pin);
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 51
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 52 air_quality_values slope(void);
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 53
mbedAustin 0:885417624ec2 54 private:
mbedAustin 0:885417624ec2 55 PinName _pin;
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 56
mbedAustin 0:885417624ec2 57 void avgVoltage(void);
mbedAustin 0:885417624ec2 58 };
lucian@192-168-0-106.rdsnet.ro 2:95009177a860 59
mbedAustin 0:885417624ec2 60 #endif