David Jung
/
MAX32664C_MAXM86146_Mode1_Optical
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 44:1b165a68474d
- Parent:
- 43:81a5371eeb7e
- Child:
- 45:d26b8bcce561
diff -r 81a5371eeb7e -r 1b165a68474d main.cpp --- a/main.cpp Fri Apr 08 20:14:22 2022 +0000 +++ b/main.cpp Tue Apr 12 22:53:08 2022 +0000 @@ -37,7 +37,7 @@ /****************************************************************************** * https://os.mbed.com/users/phonemacro/code/MAX32664C_Example_Host_Code * Tera Term output is set to 115200 baud rate. -* ver: 220408 +* ver: 220412 ******************************************************************************/ /****************************************************************************** @@ -85,7 +85,7 @@ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ //#define RAW // define this if you want AFE+accel data, no algorithm -#define ALGO_ONLY 1 // define this if you only want algo data, comment out if you want raw sensor+algo data +//#define ALGO_ONLY 1 // define this if you only want algo data, comment out if you want raw sensor+algo data // Comment out both of the below for Normal Algorithm Samples Format //#define EXTENDED_ALGO 1 // define this if you want the extended algo samples report format @@ -270,9 +270,9 @@ pc.printf("%d,%d,%d,%d,%d,%d,", ppg[6], ppg[7],ppg[8], ppg[9],ppg[10], ppg[11]); #endif // raw #endif // MAXM86146_CFG - accel[0] = (rsp[PPG_SZ+0] << 8) | (rsp[PPG_SZ+1]); - accel[1] = (rsp[PPG_SZ+2] << 8) | (rsp[PPG_SZ+3]); - accel[2] = (rsp[PPG_SZ+4] << 8) | (rsp[PPG_SZ+5]); + accel[0] = (rsp[1+PPG_SZ+0] << 8) | (rsp[1+PPG_SZ+1]); + accel[1] = (rsp[1+PPG_SZ+2] << 8) | (rsp[1+PPG_SZ+3]); + accel[2] = (rsp[1+PPG_SZ+4] << 8) | (rsp[1+PPG_SZ+5]); pc.printf("%d,%d,%d,", accel[0], accel[1], accel[2]); ptr = sptr + SENSOR_SZ; @@ -281,7 +281,6 @@ #ifndef RAW #ifdef EXTENDED_ALGO -// pc.printf("ptr %d ttlsiz %d ", ptr, TTL_SZ); opmode = rsp[ptr]; hr = (rsp[ptr+1] << 8) + rsp[ptr+2]; hr_conf = rsp[ptr+3]; @@ -580,13 +579,10 @@ mfio = 1; mfio = 0; wait_us(300); pc.printf("Ver: %d %d %d %d\n\r", rsp[0], rsp[1], rsp[2], rsp[3]); -//#if (defined(MAXM86146_CFG) || defined(MAXM86146_CFG)) && defined(PACKED_NORMAL_ALGO) // wr config mask for packed normal data output fifo #if defined(PCK_CFG_MASK) cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x20; cmd[3] = 0x7F; cmd[4] = 0xFF; cmd[5] = 0x00; -#else - cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x20; cmd[3] = 0xFF; cmd[4] = 0xFF; cmd[5] = 0x00; -#endif +// cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x20; cmd[3] = 0xFF; cmd[4] = 0xFF; cmd[5] = 0x00; sh_i2c.write(SH_ADDR, cmd, 6); mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); sh_i2c.read(SH_ADDR, rsp, 1); @@ -599,7 +595,7 @@ sh_i2c.read(SH_ADDR, rsp, 4); mfio = 1; mfio = 0; wait_us(300); pc.printf("rd config mask for packed normal data output fifo %d %X %X %X \n\r", rsp[0], rsp[1], rsp[2], rsp[3]); -//#endif +#endif #if defined(MAXM86161_CFG) || defined(MAXM86146_CFG) // rd algo sz normal