Eduardo Avelar / MAX30100

Dependents:   MAX30100_oxullo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX30100_SpO2Calculator.h Source File

MAX30100_SpO2Calculator.h

00001 /*
00002 Arduino-MAX30100 oximetry / heart rate integrated sensor library
00003 Copyright (C) 2016  OXullo Intersecans <x@brainrapers.org>
00004 This program is free software: you can redistribute it and/or modify
00005 it under the terms of the GNU General Public License as published by
00006 the Free Software Foundation, either version 3 of the License, or
00007 (at your option) any later version.
00008 This program is distributed in the hope that it will be useful,
00009 but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011 GNU General Public License for more details.
00012 You should have received a copy of the GNU General Public License
00013 along with this program.  If not, see <http://www.gnu.org/licenses/>.
00014 */
00015 
00016 #ifndef MAX30100_SPO2CALCULATOR_H
00017 #define MAX30100_SPO2CALCULATOR_H
00018 
00019 #include <stdint.h>
00020 
00021 #define CALCULATE_EVERY_N_BEATS         3
00022 
00023 class SpO2Calculator {
00024 public:
00025     SpO2Calculator();
00026 
00027     void update(float irACValue, float redACValue, bool beatDetected);
00028     void reset();
00029     uint8_t getSpO2();
00030 
00031 private:
00032     static const uint8_t spO2LUT[43];
00033 
00034     float irACValueSqSum;
00035     float redACValueSqSum;
00036     uint8_t beatsDetectedNum;
00037     uint32_t samplesRecorded;
00038     uint8_t spO2;
00039 };
00040 
00041 #endif