Mode1 Optical Validation

Dependencies:   max32630fthr

Revision:
26:33c0d3fd2a95
Parent:
25:e790416e273e
Child:
27:a45d6e38f2de
--- a/main.cpp	Tue Jun 22 17:14:30 2021 +0000
+++ b/main.cpp	Wed Jun 23 21:36:13 2021 +0000
@@ -58,8 +58,8 @@
 
 /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/
 // define which adaptor board is being used
-//#define MAXM86161_ADPTR_EVKIT_B
-#define MAXREFDES1319  // MAXM86161: Remove J7; For PIN1=ACC_INTN, J9 set to 2-3; For PIN13=OPT_INTN, J10 set to 2-3
+#define MAXM86161_ADPTR_EVKIT_B
+//#define MAXREFDES1319  // MAXM86161: Remove J7; For PIN1=ACC_INTN, J9 set to 2-3; For PIN13=OPT_INTN, J10 set to 2-3
 /******************************************************************************
 * MAX32630FTHR GPIOs
 ******************************************************************************/
@@ -78,10 +78,12 @@
 I2C sh_i2c(P3_4, P3_5);
 
 /*****************************************************************************/
-#if defined(MAXM86161_CFG)  //|| defined(MAXM86146_CFG)  // don't need 3.3V for MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR
+#if defined(MAXM86161_CFG) //|| defined(MAXM86146_CFG)  // don't need 3.3V for MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR
 #include "max32630fthr.h"
 MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); // Enable J1-pin2, 3.3V and set GPIO to 3.3v
 #endif
+
+/*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/
 //#define RAW  // define this if you only AFE+accel data, no algo
 #define ALGO_ONLY 1  // define this if you only want algo data, comment out if you want raw sensor+algo data
 //#define EXTENDED_ALGO 1  // define this if you want the extended algo format
@@ -318,7 +320,7 @@
             ibi_offset = rsp[ptr+20];
 
             sptr += (TTL_SZ);
-#if 0
+#if 1
             pc.printf("%d,%d,%d,%d,", opmode, hr, hr_conf, ibi);
             pc.printf("%d,%d,%d,%d,", ibi_conf, act, r, spo2_conf);
             pc.printf("%d,%d,%d,%d,", spo2, spo2_compl, spo2_lo, spo2_mo);
@@ -526,6 +528,7 @@
     sh_i2c.read(SH_ADDR, rsp, 1);
     mfio = 1; mfio = 0; wait_us(300);
     pc.printf("map SpO2 to slots/PDs %x\n\r", rsp[0]);
+
 #if 0
 //1.20 Sec 4.1  map leds to slots for MAXM86146
     cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x19; cmd[3] = 0x15; cmd[4] = 0x60; cmd[5] = 0x00;
@@ -558,10 +561,12 @@
     cmd[0] = 0x52; cmd[1] = 0x07; cmd[2] = 0x01;
 #endif
     sh_i2c.write(SH_ADDR, cmd, 3);
+    mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300);
     thread_sleep_for(465);
+    thread_sleep_for(465);
+    mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300);
     sh_i2c.read(SH_ADDR, rsp, 1);
     pc.printf("1.14 status: %x\n\r", rsp[0]);
-    mfio = 1;
 
 #if 1
 //1.31 rd AFE part id
@@ -578,6 +583,8 @@
     sh_i2c.read(SH_ADDR, rsp, 2);
     mfio = 1; mfio = 0; wait_us(300);
     pc.printf("1.32 who accel %x %x\n\r", rsp[0], rsp[1]);
+
+    mfio = 1;
 #endif
 }