David Jung
/
MAX32664C_MAXM86146_Mode1_Optical
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 37:249b548e6488
- Parent:
- 36:a6e7ff9c87a0
- Child:
- 38:8ff33869be1f
--- a/main.cpp Tue Apr 05 01:17:30 2022 +0000 +++ b/main.cpp Tue Apr 05 02:43:39 2022 +0000 @@ -84,13 +84,13 @@ #endif /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ -//#define RAW // define this if you want AFE+accel data, no algorithm +#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 // 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 //#define PACKED_NORMAL_ALGO 1 // define this if you want the packed normal algo samples report format, 33.13.31 - +//#define PCK_CFG_MASK 1 // define this and the above if you want to config mask out some of the packed data, , 33.13.31 //#define AGC 1 // define this for AGC, otherwise the default is AEC #ifdef MAXREFDES103_CFG @@ -390,22 +390,21 @@ ibi_offset = rsp[ptr+15]; sptr += (TTL_SZ); - -#if 0 // hex out +#if defined(PCK_CFG_MASK) // hex out, for printing config masked out packed data // print as hex bytes for (j=0; j<ALGO_SZ; j++) pc.printf("%02X ", rsp[ptr+j]); //pc.printf("\n\r" ); #endif - -#if 1 -#if 1 +#if !defined(PCK_CFG_MASK) + #if 1 + #if 1 // print all if (heading_printed == 0) { heading_printed = 1; -#if defined(ALGO_ONLY) + #if defined(ALGO_ONLY) pc.printf("opmode,hr,hr_conf,ibi,ibi_conf,act,r,spo2_conf,spo2,spo2_compl,spo2_lo,spo2_mo,spo2_lopi,spo2_unrel,spo2_state,scd,ibioffset,inappro_ori,\n\r"); -#endif + #endif } pc.printf("%d,%d,%d,%d,", opmode, hr, hr_conf, ibi); pc.printf("%d,%d,%d,%d,", ibi_conf, act, r, spo2_conf); @@ -413,19 +412,21 @@ pc.printf("%d,%d,%d,%d,", spo2_lopi,spo2_unrel, spo2_state, scd); pc.printf("%d,", ibi_offset); pc.printf("%d,", inappro_ori); -#endif -#else + #endif + #else // print some if (heading_printed == 0) { heading_printed = 1; -#if defined(ALGO_ONLY) + #if defined(ALGO_ONLY) pc.printf("hr,hr_conf,spo2,spo2_conf,spo2_lo,spo2_unrel,scd,\n\r"); -#endif + #endif } pc.printf("%d,%d,", hr, hr_conf); pc.printf("%d,%d,", spo2, spo2_conf); pc.printf("%d,", spo2_lo); pc.printf("%d,%d,", spo2_unrel, scd); -#endif + #endif +#endif // #if defined(PCK_CFG_MASK) + #else // normal algo size // pc.printf("ptr %d ttlsiz %d ", ptr, TTL_SZ); opmode = rsp[ptr]; @@ -567,8 +568,11 @@ //#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; - cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x20; cmd[3] = 0x7F; cmd[4] = 0xFF; cmd[5] = 0x00; +#endif 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);