MAX30100 pulse and oximeter sensor library

Ported from Arduino library

Committer:
kohlerba
Date:
Tue Nov 21 20:34:45 2017 +0000
Revision:
0:0307ce7b7033
MAX30100 sensor

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kohlerba 0:0307ce7b7033 1 #ifndef MAX30100_H
kohlerba 0:0307ce7b7033 2 #define MAX30100_H
kohlerba 0:0307ce7b7033 3
kohlerba 0:0307ce7b7033 4 #include "max30100_reg.h"
kohlerba 0:0307ce7b7033 5 #include "mbed.h"
kohlerba 0:0307ce7b7033 6
kohlerba 0:0307ce7b7033 7 typedef enum{ // This is the same for both LEDs
kohlerba 0:0307ce7b7033 8 pw200, // 200us pulse
kohlerba 0:0307ce7b7033 9 pw400, // 400us pulse
kohlerba 0:0307ce7b7033 10 pw800, // 800us pulse
kohlerba 0:0307ce7b7033 11 pw1600 // 1600us pulse
kohlerba 0:0307ce7b7033 12 }pulseWidth;
kohlerba 0:0307ce7b7033 13
kohlerba 0:0307ce7b7033 14 typedef enum{
kohlerba 0:0307ce7b7033 15 sr50, // 50 samples per second
kohlerba 0:0307ce7b7033 16 sr100, // 100 samples per second
kohlerba 0:0307ce7b7033 17 sr167, // 167 samples per second
kohlerba 0:0307ce7b7033 18 sr200, // 200 samples per second
kohlerba 0:0307ce7b7033 19 sr400, // 400 samples per second
kohlerba 0:0307ce7b7033 20 sr600, // 600 samples per second
kohlerba 0:0307ce7b7033 21 sr800, // 800 samples per second
kohlerba 0:0307ce7b7033 22 sr1000 // 1000 samples per second
kohlerba 0:0307ce7b7033 23 }sampleRate;
kohlerba 0:0307ce7b7033 24
kohlerba 0:0307ce7b7033 25 typedef enum{
kohlerba 0:0307ce7b7033 26 i0, // No current
kohlerba 0:0307ce7b7033 27 i4, // 4.4mA
kohlerba 0:0307ce7b7033 28 i8, // 7.6mA
kohlerba 0:0307ce7b7033 29 i11, // 11.0mA
kohlerba 0:0307ce7b7033 30 i14, // 14.2mA
kohlerba 0:0307ce7b7033 31 i17, // 17.4mA
kohlerba 0:0307ce7b7033 32 i21, // 20.8mA
kohlerba 0:0307ce7b7033 33 i27, // 27.1mA
kohlerba 0:0307ce7b7033 34 i31, // 30.6mA
kohlerba 0:0307ce7b7033 35 i34, // 33.8mA
kohlerba 0:0307ce7b7033 36 i37, // 37.0mA
kohlerba 0:0307ce7b7033 37 i40, // 40.2mA
kohlerba 0:0307ce7b7033 38 i44, // 43.6mA
kohlerba 0:0307ce7b7033 39 i47, // 46.8mA
kohlerba 0:0307ce7b7033 40 i50 // 50.0mA
kohlerba 0:0307ce7b7033 41 }ledCurrent;
kohlerba 0:0307ce7b7033 42
kohlerba 0:0307ce7b7033 43 class max30100 {
kohlerba 0:0307ce7b7033 44
kohlerba 0:0307ce7b7033 45 protected:
kohlerba 0:0307ce7b7033 46
kohlerba 0:0307ce7b7033 47 public:
kohlerba 0:0307ce7b7033 48
kohlerba 0:0307ce7b7033 49 //
kohlerba 0:0307ce7b7033 50 int i2c_write (uint8_t i2c_addr, uint8_t register_addr, char* buffer, uint8_t Nbyte );
kohlerba 0:0307ce7b7033 51 int i2c_read (uint8_t i2c_addr, uint8_t register_addr, char* buffer, uint8_t Nbyte );
kohlerba 0:0307ce7b7033 52 //
kohlerba 0:0307ce7b7033 53
kohlerba 0:0307ce7b7033 54 void setLEDs(pulseWidth pw, ledCurrent red, ledCurrent ir);
kohlerba 0:0307ce7b7033 55 void setSPO2(sampleRate sr);
kohlerba 0:0307ce7b7033 56 int getNumSamp(void);
kohlerba 0:0307ce7b7033 57 void readSensor(void);
kohlerba 0:0307ce7b7033 58 void shutdown(void);
kohlerba 0:0307ce7b7033 59 void reset(void);
kohlerba 0:0307ce7b7033 60 void startup(void);
kohlerba 0:0307ce7b7033 61 uint8_t getRevID(void);
kohlerba 0:0307ce7b7033 62 uint8_t getPartID(void);
kohlerba 0:0307ce7b7033 63 void begin(pulseWidth pw, ledCurrent ir, sampleRate sr);
kohlerba 0:0307ce7b7033 64 void printRegisters(void);
kohlerba 0:0307ce7b7033 65 };
kohlerba 0:0307ce7b7033 66 #endif