David Jung
/
MAX32664C_MAXM86146_Mode1_Optical
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 56:60b61d5c8154
- Parent:
- 55:04c9fad147d4
- Child:
- 57:51feeb984d0b
--- a/main.cpp Fri May 20 00:17:29 2022 +0000 +++ b/main.cpp Fri May 20 00:44:49 2022 +0000 @@ -93,8 +93,8 @@ //#define RAW_HZ 200 // Raw data rate //#define RAW_HZ 2004 // Raw data rate 200 Hz, ave 4 //#define SPO2_CAL_RPT 1 -#define MAXM86161_OPT_VALIDATION_RED 1 // Optical validatation -#define MAXM86161_OPT_VALIDATION_IR 1 // Optical validatation +//#define MAXM86161_OPT_VALIDATION_RED 1 // Optical validatation +//#define MAXM86161_OPT_VALIDATION_IR 1 // Optical validatation #define MAXM86161_OPT_VALIDATION_GRN 1 // Optical validatation #define SENSOR_ONLY 1 @@ -104,7 +104,7 @@ //#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 -//#define USE_SYN 1 +#define USE_SYN 1 //#define REDUCE_RPT_PERIOD 0x19 // Report samples every 25 frame. //#define USE_FIFO_BUFFER_CNT 5 // Allow the FIFO to accumulate this many samples @@ -142,13 +142,17 @@ #endif #endif -#ifdef ALGO_ONLY - #define TTL_SZ (ALGO_SZ) +#if defined(MAXM86161_OPT_VALIDATION_GRN) || defined(MAXM86161_OPT_VALIDATION_RED) || defined(MAXM86161_OPT_VALIDATION_IR) + #define TTL_SZ (PPG_SZ) #else - #ifdef RAW - #define TTL_SZ (PPG_SZ+ACCEL_SZ) + #ifdef ALGO_ONLY + #define TTL_SZ (ALGO_SZ) #else - #define TTL_SZ (PPG_SZ+ACCEL_SZ+ALGO_SZ) + #ifdef RAW + #define TTL_SZ (PPG_SZ+ACCEL_SZ) + #else + #define TTL_SZ (PPG_SZ+ACCEL_SZ+ALGO_SZ) + #endif #endif #endif @@ -1157,6 +1161,7 @@ mfio = 1; mfio = 0; wait_us(300); pc.printf("wr afe reg Status: %x\n\r", rsp[0]); + // Set Green, current cmd[0] = 0x40; cmd[1] = 0x00; cmd[2] = 0x23; cmd[3] = 0xA7; sh_i2c.write(SH_ADDR, cmd, 4); mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); @@ -1164,14 +1169,16 @@ mfio = 1; mfio = 0; wait_us(300); pc.printf("wr afe reg Status: %x\n\r", rsp[0]); - cmd[0] = 0x40; cmd[1] = 0x00; cmd[2] = 0x24; cmd[3] = 0x00; + // Set IR current + cmd[0] = 0x40; cmd[1] = 0x00; cmd[2] = 0x24; cmd[3] = 0x0; sh_i2c.write(SH_ADDR, cmd, 4); mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); sh_i2c.read(SH_ADDR, rsp, 1); mfio = 1; mfio = 0; wait_us(300); pc.printf("wr afe reg Status: %x\n\r", rsp[0]); - cmd[0] = 0x40; cmd[1] = 0x00; cmd[2] = 0x25; cmd[3] = 0x00; + // Set Red current + cmd[0] = 0x40; cmd[1] = 0x00; cmd[2] = 0x25; cmd[3] = 0x0; sh_i2c.write(SH_ADDR, cmd, 4); mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); sh_i2c.read(SH_ADDR, rsp, 1);