David Jung
/
MAX32664C_MAXM86146_Mode1_Optical
Mode1 Optical Validation
Diff: main.cpp
- Revision:
- 22:f6b366c3b954
- Parent:
- 21:67d58af1ec56
- Child:
- 23:e7ecf1416965
--- a/main.cpp Thu Jun 17 20:46:18 2021 +0000 +++ b/main.cpp Thu Jun 17 21:28:43 2021 +0000 @@ -55,7 +55,7 @@ //#define MAXREFDES103_CFG // not tested //#define MAXM86161_CFG 1 // tested on MAXM86161+MAX32630FTHR v32.9.22, 32.13.12 /*****************************************************************************/ -#if defined(MAXM86161_CFG) // || defined(MAXM86146_CFG) // don't need 3.3V for MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR +#if defined(MAXM86161_CFG) //|| defined(MAXM86146_CFG) // don't need 3.3V for MAXM86146EVSYS_sensorBrd+MAXM86161_ADAPTER_REVB+MAX32630FTHR #include "max32630fthr.h" MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); // Enable J1-pin2, 3.3V and set GPIO to 3.3v #endif @@ -150,23 +150,21 @@ int32_t sptr = 0; mfio = 0; wait_us(300); Time_to_Read_PPG = 0; -#if 0 +#if defined(MAXREFDES103_CFG) || defined(MAXM86161_CFG) // 2.1 cmd[0] = 0x00; cmd[1] = 0x00; sh_i2c.write(SH_ADDR, cmd, 2); - mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); -// wait_us(100); + wait_us(100); sh_i2c.read(SH_ADDR, rsp, 2); - mfio = 1; mfio = 0; wait_us(300); // pc.printf("2.1 Status: %x %x\n\r", rsp[0], rsp[1]); +#else + // testd 33.13.12 doesn't need 2.1 #endif // 2.2 cmd[0] = 0x12; cmd[1] = 0x00; sh_i2c.write(SH_ADDR, cmd, 2); - mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); -// wait_us(100); + wait_us(100); sh_i2c.read(SH_ADDR, rsp, 2); - mfio = 1; mfio = 0; wait_us(300); // pc.printf("2.2 Status: %x %x\n\r", rsp[0], rsp[1]); samples = rsp[1]; // pc.printf("num samples %d, (num*ttl)+1 %d\n\r", rsp[1], TTL_SZ*samples+1); @@ -175,12 +173,9 @@ // 2.3 cmd[0] = 0x12; cmd[1] = 0x01; sh_i2c.write(SH_ADDR, cmd, 2); - mfio = 1; thread_sleep_for(2); mfio = 0; wait_us(300); -// wait_us(100); -// thread_sleep_for(1); + wait_us(100); sh_i2c.read(SH_ADDR, rsp, 1+(TTL_SZ*samples)); - mfio = 1; mfio = 0; wait_us(300); -// mfio = 1; + mfio = 1; status = rsp[0];