m
Fork of MAX30100 by
MAX30100_SpO2Calculator.h@1:e3b9aff8f221, 2016-12-03 (annotated)
- Committer:
- arturogasca
- Date:
- Sat Dec 03 11:43:35 2016 +0000
- Revision:
- 1:e3b9aff8f221
- Parent:
- 0:010b908e2187
max30100
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
AVELARDEV | 0:010b908e2187 | 1 | /* |
AVELARDEV | 0:010b908e2187 | 2 | Arduino-MAX30100 oximetry / heart rate integrated sensor library |
AVELARDEV | 0:010b908e2187 | 3 | Copyright (C) 2016 OXullo Intersecans <x@brainrapers.org> |
AVELARDEV | 0:010b908e2187 | 4 | This program is free software: you can redistribute it and/or modify |
AVELARDEV | 0:010b908e2187 | 5 | it under the terms of the GNU General Public License as published by |
AVELARDEV | 0:010b908e2187 | 6 | the Free Software Foundation, either version 3 of the License, or |
AVELARDEV | 0:010b908e2187 | 7 | (at your option) any later version. |
AVELARDEV | 0:010b908e2187 | 8 | This program is distributed in the hope that it will be useful, |
AVELARDEV | 0:010b908e2187 | 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
AVELARDEV | 0:010b908e2187 | 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
AVELARDEV | 0:010b908e2187 | 11 | GNU General Public License for more details. |
AVELARDEV | 0:010b908e2187 | 12 | You should have received a copy of the GNU General Public License |
AVELARDEV | 0:010b908e2187 | 13 | along with this program. If not, see <http://www.gnu.org/licenses/>. |
AVELARDEV | 0:010b908e2187 | 14 | */ |
AVELARDEV | 0:010b908e2187 | 15 | |
AVELARDEV | 0:010b908e2187 | 16 | #ifndef MAX30100_SPO2CALCULATOR_H |
AVELARDEV | 0:010b908e2187 | 17 | #define MAX30100_SPO2CALCULATOR_H |
AVELARDEV | 0:010b908e2187 | 18 | |
AVELARDEV | 0:010b908e2187 | 19 | #include <stdint.h> |
AVELARDEV | 0:010b908e2187 | 20 | |
AVELARDEV | 0:010b908e2187 | 21 | #define CALCULATE_EVERY_N_BEATS 3 |
AVELARDEV | 0:010b908e2187 | 22 | |
AVELARDEV | 0:010b908e2187 | 23 | class SpO2Calculator { |
AVELARDEV | 0:010b908e2187 | 24 | public: |
AVELARDEV | 0:010b908e2187 | 25 | SpO2Calculator(); |
AVELARDEV | 0:010b908e2187 | 26 | |
AVELARDEV | 0:010b908e2187 | 27 | void update(float irACValue, float redACValue, bool beatDetected); |
AVELARDEV | 0:010b908e2187 | 28 | void reset(); |
AVELARDEV | 0:010b908e2187 | 29 | uint8_t getSpO2(); |
AVELARDEV | 0:010b908e2187 | 30 | |
AVELARDEV | 0:010b908e2187 | 31 | private: |
AVELARDEV | 0:010b908e2187 | 32 | static const uint8_t spO2LUT[43]; |
AVELARDEV | 0:010b908e2187 | 33 | |
AVELARDEV | 0:010b908e2187 | 34 | float irACValueSqSum; |
AVELARDEV | 0:010b908e2187 | 35 | float redACValueSqSum; |
AVELARDEV | 0:010b908e2187 | 36 | uint8_t beatsDetectedNum; |
AVELARDEV | 0:010b908e2187 | 37 | uint32_t samplesRecorded; |
AVELARDEV | 0:010b908e2187 | 38 | uint8_t spO2; |
AVELARDEV | 0:010b908e2187 | 39 | }; |
AVELARDEV | 0:010b908e2187 | 40 | |
AVELARDEV | 0:010b908e2187 | 41 | #endif |