m
Fork of MAX30100 by
MAX30100.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_H |
AVELARDEV | 0:010b908e2187 | 17 | #define MAX30100_H |
AVELARDEV | 0:010b908e2187 | 18 | |
AVELARDEV | 0:010b908e2187 | 19 | #include <stdint.h> |
AVELARDEV | 0:010b908e2187 | 20 | #include "mbed.h" |
AVELARDEV | 0:010b908e2187 | 21 | #include "MAX30100_Registers.h" |
AVELARDEV | 0:010b908e2187 | 22 | |
AVELARDEV | 0:010b908e2187 | 23 | #define DEFAULT_MODE MAX30100_MODE_HRONLY |
AVELARDEV | 0:010b908e2187 | 24 | #define DEFAULT_SAMPLING_RATE MAX30100_SAMPRATE_100HZ |
AVELARDEV | 0:010b908e2187 | 25 | #define DEFAULT_PULSE_WIDTH MAX30100_SPC_PW_1600US_16BITS |
AVELARDEV | 0:010b908e2187 | 26 | #define DEFAULT_RED_LED_CURRENT MAX30100_LED_CURR_50MA |
AVELARDEV | 0:010b908e2187 | 27 | #define DEFAULT_IR_LED_CURRENT MAX30100_LED_CURR_50MA |
AVELARDEV | 0:010b908e2187 | 28 | |
AVELARDEV | 0:010b908e2187 | 29 | #define I2C_BUS_SPEED 400000UL |
AVELARDEV | 0:010b908e2187 | 30 | |
AVELARDEV | 0:010b908e2187 | 31 | class MAX30100 { |
AVELARDEV | 0:010b908e2187 | 32 | public: |
AVELARDEV | 0:010b908e2187 | 33 | MAX30100(); |
AVELARDEV | 0:010b908e2187 | 34 | bool begin(); |
AVELARDEV | 0:010b908e2187 | 35 | bool setMode(Mode mode); |
AVELARDEV | 0:010b908e2187 | 36 | bool setLedsPulseWidth(LEDPulseWidth ledPulseWidth); |
AVELARDEV | 0:010b908e2187 | 37 | bool setSamplingRate(SamplingRate samplingRate); |
AVELARDEV | 0:010b908e2187 | 38 | bool setLedsCurrent(LEDCurrent irLedCurrent, LEDCurrent redLedCurrent); |
AVELARDEV | 0:010b908e2187 | 39 | bool setHighresModeEnabled(bool enabled); |
AVELARDEV | 0:010b908e2187 | 40 | bool update(); |
AVELARDEV | 0:010b908e2187 | 41 | |
AVELARDEV | 0:010b908e2187 | 42 | uint16_t rawIRValue; |
AVELARDEV | 0:010b908e2187 | 43 | uint16_t rawRedValue; |
AVELARDEV | 0:010b908e2187 | 44 | |
AVELARDEV | 0:010b908e2187 | 45 | private: |
AVELARDEV | 0:010b908e2187 | 46 | /* |
AVELARDEV | 0:010b908e2187 | 47 | uint8_t readRegister(uint8_t address); |
AVELARDEV | 0:010b908e2187 | 48 | void writeRegister(uint8_t address, uint8_t data); |
AVELARDEV | 0:010b908e2187 | 49 | void burstRead(uint8_t baseAddress, uint8_t *buffer, uint8_t length); |
AVELARDEV | 0:010b908e2187 | 50 | void readFifoData(); |
AVELARDEV | 0:010b908e2187 | 51 | */ |
AVELARDEV | 0:010b908e2187 | 52 | |
AVELARDEV | 0:010b908e2187 | 53 | bool writeRegister(uint8_t uch_addr, uint8_t uch_data); |
AVELARDEV | 0:010b908e2187 | 54 | bool readRegister(uint8_t uch_addr, uint8_t *puch_data); |
AVELARDEV | 0:010b908e2187 | 55 | bool readFifoData(); |
AVELARDEV | 0:010b908e2187 | 56 | }; |
AVELARDEV | 0:010b908e2187 | 57 | |
AVELARDEV | 0:010b908e2187 | 58 | #endif |