David Jung
/
MAX32664C_MAXM86146_Mode1_Optical
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 52:e5aba237e804
- Parent:
- 51:e2214db671c0
- Child:
- 53:034f646141ae
--- a/main.cpp Tue May 10 02:49:43 2022 +0000 +++ b/main.cpp Wed May 11 22:55:14 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: 220429 +* ver: 220511 ******************************************************************************/ /****************************************************************************** @@ -51,9 +51,9 @@ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ // define one and only one of the following three platforms -#define MAXM86146_CFG 1 // tested on MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR 33.13.12 +//#define MAXM86146_CFG 1 // tested on MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR 33.13.12 //#define MAXREFDES103_CFG // not tested -//#define MAXM86161_CFG 1 // tested on MAXM86161+MAX32630FTHR v32.9.22, 32.13.12 +#define MAXM86161_CFG 1 // tested on MAXM86161+MAX32630FTHR v32.9.22, 32.13.12 /*****************************************************************************/ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ @@ -92,7 +92,7 @@ //#define RAW_HZ 100 // Raw data rate //#define RAW_HZ 200 // Raw data rate //#define RAW_HZ 2004 // Raw data rate 200 Hz, ave 4 -//#define SPO2_CAL_RPT 1 +#define SPO2_CAL_RPT 1 // 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 @@ -650,17 +650,15 @@ sh_i2c.read(SH_ADDR, rsp, 1); mfio = 1; mfio = 0; wait_us(300); pc.printf("1.2 Status: %x\n\r", rsp[0]); -// 1.5 cont hr, spo2 -#ifdef SPO2_CAL_RPT - cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x0A; cmd[3] = 0x06; -#else +// 1.4 Continuous HR, Spo2 +#ifndef SPO2_CAL_RPT cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x0A; cmd[3] = 0x00; -#endif 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("1.5 Status: %x\n\r", rsp[0]); +#endif // 1.5 AEC enable (default) cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x0B; cmd[3] = 0x01; sh_i2c.write(SH_ADDR, cmd, 4); @@ -849,6 +847,23 @@ mfio = 1; mfio = 0; wait_us(300); pc.printf("1.32 who accel %x %x\n\r", rsp[0], rsp[1]); #endif +// 1.35 spo2 calibration report for data collection +#ifdef SPO2_CAL_RPT + cmd[0] = 0x50; cmd[1] = 0x07; cmd[2] = 0x0A; cmd[3] = 0x06; + 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("1.5 Status: %x\n\r", rsp[0]); +#endif +// rd algo mode + cmd[0] = 0x51; cmd[1] = 0x07; cmd[2] = 0x0A; + sh_i2c.write(SH_ADDR, cmd, 3); + mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); + sh_i2c.read(SH_ADDR, rsp, 2); + mfio = 1; mfio = 0; wait_us(300); + pc.printf("algo mode %x %x\n\r", rsp[0], rsp[1]); + mfio = 1; }