Eduardo Avelar / MAX30100

Dependents:   MAX30100_oxullo

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MAX30100.h Source File

MAX30100.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_H
00017 #define MAX30100_H
00018 
00019 #include <stdint.h>
00020 #include "mbed.h"
00021 #include "MAX30100_Registers.h"
00022 
00023 #define DEFAULT_MODE                MAX30100_MODE_HRONLY
00024 #define DEFAULT_SAMPLING_RATE       MAX30100_SAMPRATE_100HZ
00025 #define DEFAULT_PULSE_WIDTH         MAX30100_SPC_PW_1600US_16BITS
00026 #define DEFAULT_RED_LED_CURRENT     MAX30100_LED_CURR_50MA
00027 #define DEFAULT_IR_LED_CURRENT      MAX30100_LED_CURR_50MA
00028 
00029 #define I2C_BUS_SPEED               400000UL
00030 
00031 class MAX30100 {
00032 public:
00033     MAX30100();
00034     bool begin();
00035     bool setMode(Mode mode);
00036     bool setLedsPulseWidth(LEDPulseWidth ledPulseWidth);
00037     bool setSamplingRate(SamplingRate samplingRate);
00038     bool setLedsCurrent(LEDCurrent irLedCurrent, LEDCurrent redLedCurrent);
00039     bool setHighresModeEnabled(bool enabled);
00040     bool update();
00041 
00042     uint16_t rawIRValue;
00043     uint16_t rawRedValue;
00044 
00045 private:
00046     /*
00047     uint8_t readRegister(uint8_t address);
00048     void writeRegister(uint8_t address, uint8_t data);
00049     void burstRead(uint8_t baseAddress, uint8_t *buffer, uint8_t length);
00050     void readFifoData();
00051     */
00052     
00053     bool writeRegister(uint8_t uch_addr, uint8_t uch_data);
00054     bool readRegister(uint8_t uch_addr, uint8_t *puch_data);
00055     bool readFifoData();
00056 };
00057 
00058 #endif