![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 45:d26b8bcce561
- Parent:
- 44:1b165a68474d
- Child:
- 46:553559610878
--- a/main.cpp Tue Apr 12 22:53:08 2022 +0000 +++ b/main.cpp Tue Apr 19 23:23:51 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: 220412 +* ver: 220419 ******************************************************************************/ /****************************************************************************** @@ -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.31/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.23, 32.13.12 +#define MAXM86161_CFG 1 // tested on MAXM86161+MAX32630FTHR v32.9.22, 32.13.12 /*****************************************************************************/ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ @@ -85,17 +85,17 @@ /*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*/ //#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 //#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 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 REDUCE_RPT_PERIOD 0x19 // Report samples every 25 frame. -//#define USE_FIFO_BUFFER_CNT 5 // Allow the FIFO to fill this many samples +//#define USE_FIFO_BUFFER_CNT 5 // Allow the FIFO to accumulate this many samples #ifdef MAXREFDES103_CFG #include "MAX20303.h" @@ -207,7 +207,7 @@ sh_i2c.read(SH_ADDR, rsp, 2); // pc.printf("2.1 Status: %x %x\n\r", rsp[0], rsp[1]); #else - // tested w/ 33.13.12 doen't need 2.1 + // tested w/ 33.13.12 don't need 2.1 #endif // 2.2 #if defined(PACKED_NORMAL_ALGO) @@ -236,14 +236,14 @@ cmd[0] = 0x21;; sh_i2c.write(SH_ADDR, cmd, 1); #else - cmd[0] = 0x12; cmd[1] = 0x01; - sh_i2c.write(SH_ADDR, cmd, 2); + cmd[0] = 0x12; cmd[1] = 0x01; + sh_i2c.write(SH_ADDR, cmd, 2); #endif - wait_us(100); - sh_i2c.read(SH_ADDR, rsp, 1+(TTL_SZ*samples)); + wait_us(100); + sh_i2c.read(SH_ADDR, rsp, 1+(TTL_SZ*samples)); //pc.printf("num smpls %d ttlsiz %d\n\r", samples, TTL_SZ); // mfio = 1; mfio = 0; wait_us(300); - mfio = 1; + mfio = 1; status = rsp[0]; @@ -281,6 +281,7 @@ #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]; @@ -619,7 +620,7 @@ sh_i2c.read(SH_ADDR, rsp, 2); mfio = 1; mfio = 0; wait_us(300); pc.printf("rd algo size: %d %d \n\r", rsp[0], rsp[1]); -#if defined(MAXM86161_CFG) || defined(MAXM86146_CFG) +#if defined(PACKED_NORMAL_ALGO) && (defined(MAXM86161_CFG) || defined(MAXM86146_CFG)) // rd algo sz packed normal cmd[0] = 0x11; cmd[1] = 0x06; cmd[2] = 0x04; sh_i2c.write(SH_ADDR, cmd, 3);