Bradley Kohler / MAX30100
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers max30100.h Source File

max30100.h

00001 #ifndef MAX30100_H
00002 #define MAX30100_H
00003 
00004 #include "max30100_reg.h"
00005 #include "mbed.h"
00006 
00007 typedef enum{ // This is the same for both LEDs
00008   pw200,    // 200us pulse
00009   pw400,    // 400us pulse
00010   pw800,    // 800us pulse
00011   pw1600    // 1600us pulse
00012 }pulseWidth;
00013 
00014 typedef enum{
00015   sr50,    // 50 samples per second
00016   sr100,   // 100 samples per second
00017   sr167,   // 167 samples per second
00018   sr200,   // 200 samples per second
00019   sr400,   // 400 samples per second
00020   sr600,   // 600 samples per second
00021   sr800,   // 800 samples per second
00022   sr1000   // 1000 samples per second
00023 }sampleRate;
00024 
00025 typedef enum{
00026   i0,    // No current
00027   i4,    // 4.4mA
00028   i8,    // 7.6mA
00029   i11,   // 11.0mA
00030   i14,   // 14.2mA
00031   i17,   // 17.4mA
00032   i21,   // 20.8mA
00033   i27,   // 27.1mA
00034   i31,   // 30.6mA
00035   i34,   // 33.8mA
00036   i37,   // 37.0mA
00037   i40,   // 40.2mA
00038   i44,   // 43.6mA
00039   i47,   // 46.8mA
00040   i50    // 50.0mA
00041 }ledCurrent;
00042 
00043 class max30100 {
00044  
00045     protected:
00046  
00047     public:
00048 
00049     //
00050     int i2c_write (uint8_t i2c_addr, uint8_t register_addr, char* buffer, uint8_t Nbyte );
00051     int i2c_read (uint8_t i2c_addr, uint8_t register_addr, char* buffer, uint8_t Nbyte );
00052     //
00053    
00054     void setLEDs(pulseWidth pw, ledCurrent red, ledCurrent ir);
00055     void setSPO2(sampleRate sr);
00056     int getNumSamp(void);
00057     void readSensor(void);
00058     void shutdown(void);
00059     void reset(void);
00060     void startup(void);
00061     uint8_t getRevID(void);
00062     uint8_t getPartID(void);
00063     void begin(pulseWidth pw, ledCurrent ir, sampleRate sr);
00064     void printRegisters(void);
00065 };
00066 #endif