Deniz Dosluoglu / Mbed 2 deprecated RD117_MBED_mod

Dependencies:   ToScreen mbed

Fork of RD117_MBED by Maxim Integrated

Revision:
5:27d600e46926
Parent:
4:5273ab1085ab
Child:
6:519bdb0ec306
--- a/MAX30102/MAX30102.cpp	Thu May 19 22:04:06 2016 +0000
+++ b/MAX30102/MAX30102.cpp	Tue Apr 10 03:36:39 2018 +0000
@@ -124,23 +124,25 @@
 */
 {
   if(!maxim_max30102_write_reg(REG_INTR_ENABLE_1,0xc0)) // INTR setting
-    return false;
+    return false; //ppg_rdy_en
   if(!maxim_max30102_write_reg(REG_INTR_ENABLE_2,0x00))
-    return false;
+    return false; //does not use internal temp die
   if(!maxim_max30102_write_reg(REG_FIFO_WR_PTR,0x00))  //FIFO_WR_PTR[4:0]
     return false;
   if(!maxim_max30102_write_reg(REG_OVF_COUNTER,0x00))  //OVF_COUNTER[4:0]
     return false;
   if(!maxim_max30102_write_reg(REG_FIFO_RD_PTR,0x00))  //FIFO_RD_PTR[4:0]
     return false;
-  if(!maxim_max30102_write_reg(REG_FIFO_CONFIG,0x0f))  //sample avg = 1, fifo rollover=false, fifo almost full = 17
-    return false;
+  //if(!maxim_max30102_write_reg(REG_FIFO_CONFIG,0x0f))  //sample avg = 1, fifo rollover=false, fifo almost full = 17
+  if(!maxim_max30102_write_reg(REG_FIFO_CONFIG,0x4f)) // sample avg = 4
+    return false; // no adjacent samples are averaged, "pure" data, set to 0 samples left when next is called
   if(!maxim_max30102_write_reg(REG_MODE_CONFIG,0x03))   //0x02 for Red only, 0x03 for SpO2 mode 0x07 multimode LED
-    return false;
+    return false; // no "shutdown control/power save mode" (bit 7), no reset (bit 6), spo2 mode, what is multimode LED?
   if(!maxim_max30102_write_reg(REG_SPO2_CONFIG,0x27))  // SPO2_ADC range = 4096nA, SPO2 sample rate (100 Hz), LED pulseWidth (400uS)
-    return false;
+    //if(!maxim_max30102_write_reg(REG_SPO2_CONFIG,0x03))  // SPO2_ADC range = 2048nA, SPO2 sample rate (50 Hz), LED pulseWidth (400uS)
+    return false; //HIGHEST RESOLUTION
   
-  if(!maxim_max30102_write_reg(REG_LED1_PA,0x24))   //Choose value for ~ 7mA for LED1
+  if(!maxim_max30102_write_reg(REG_LED1_PA,0x24))   //Choose value for ~ 7mA for LED1 //WHY??
     return false;
   if(!maxim_max30102_write_reg(REG_LED2_PA,0x24))   // Choose value for ~ 7mA for LED2
     return false;
@@ -213,7 +215,7 @@
 * \retval       true on success
 */
 {
-    if(!maxim_max30102_write_reg(REG_MODE_CONFIG,0x40))
+    if(!maxim_max30102_write_reg(REG_MODE_CONFIG,0x40)) //STRAIGHT UP RESET
         return false;
     else
         return true;