alan broad
/
carbon_v5_arm_studio
arm studio build
Diff: src/commI2C.cpp
- Revision:
- 5:abfe25f0de33
- Parent:
- 2:0af50f386eb2
- Child:
- 8:a5316708e51d
diff -r d87f8dcf40ef -r abfe25f0de33 src/commI2C.cpp --- a/src/commI2C.cpp Sat Aug 04 20:26:39 2018 +0000 +++ b/src/commI2C.cpp Mon Aug 06 19:11:02 2018 +0000 @@ -8,6 +8,7 @@ DigitalInOut wake(PA_0); extern Serial pc; +extern bool verbose; //#define TEST @@ -32,22 +33,22 @@ #ifdef NOT_USED void i2c_wait4wake_lo(void){ wake.input(); -// pc.printf("\n\r waiting for wake to go hi %d",wake); +// if(verbose)pc.printf("\n\r waiting for wake to go hi %d",wake); bool wakeHi= false; while(!wakeHi){ wait_ms(10); //need this wait else loop below will block previous printout wakeHi = wake; // state of wake signal } - // pc.printf("\n\r detected wake hi"); + // if(verbose)pc.printf("\n\r detected wake hi"); wait_ms(100); //need this wait else loop below will block previous printout //wake signal hi,wait until it goes back lo => psoc is going to wait for .... - // pc.printf("\n\r waiting for wake to go lo %d",wake); + // if(verbose)pc.printf("\n\r waiting for wake to go lo %d",wake); bool wakeLo = true; while(wakeLo){ wait_ms(10); //need this wait else loop below will block previous printout wakeLo = wake; // state of wake signal } - //pc.printf("\n\r detected wake lo "); + //if(verbose)pc.printf("\n\r detected wake lo "); wait_ms(100); //wait for proc to get ready for i2c comm, proc leave wake in low state @@ -96,7 +97,7 @@ //============================================================================== I2C_XFR_TYPE i2c_proc_comm(void) { - bool verbose = false; + uint32_t timeout = 0x000fffff; //1.1second timeout while(1){ @@ -107,15 +108,16 @@ return I2C_WRITE; case I2CSlave::WriteAddressed: //xdot <- proc slave.read((char *)buf_rcv, BUFFER_SIZE_I2C); +/* if (verbose){ pc.printf("\n\r Incoming buffer(hex): \n\r"); int j; for (j = 0; j < BUFFER_SIZE_I2C; j++){ - pc.printf("%x", buf_rcv[j]); - pc.printf(" "); - } - + pc.printf("%x", buf_rcv[j]); + pc.printf(" "); + } } +*/ return I2C_READ; default: }; //switch