alan broad
/
carbon_v5_arm_studio
arm studio build
Diff: src/commI2C.cpp
- Revision:
- 26:f51ff4ad7a93
- Parent:
- 18:d95e1a2c4303
- Child:
- 27:ee9c063a535b
--- a/src/commI2C.cpp Fri Nov 08 16:47:04 2019 +0000 +++ b/src/commI2C.cpp Sat Feb 22 18:14:25 2020 +0000 @@ -22,43 +22,11 @@ return; } //============================================================================== -// i2c_wait4wake_lo -// - wait for the wake signal from proc to go low -// NEEDS TO BE CORRECTED, THIS WAITS FOR A HI THEN A LOW !!!! -//============================================================================== -/* -//#ifdef NOT_USED -void i2c_wait4wake_lo(void){ - wake.input(); -// 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 - } - // 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 .... - // 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 - } - //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 - - - return; -} -//#endif -*/ -//============================================================================== // i2c_pulse_wake // - pulse the wake signal to tell proc that xdot ready for i2c xfr //============================================================================== void i2c_pulse_wake(void){ - wake.mode(OpenDrain); + //wake.mode(OpenDrain); wake.output(); wake = 1; wait_ms(10); //proc uses interrupts on lora_wake, so don't need to wait,just pulse it @@ -105,11 +73,10 @@ int i = slave.receive(); switch (i) { case I2CSlave::ReadAddressed: //xdot -> proc - slave.write((char *)buf_xmt,bufSize); + slave.write((char *)buf_xmt,bufSize); return I2C_WRITE; case I2CSlave::WriteAddressed: //xdot <- proc - slave.read((char *)buf_rcv,bufSize); -/* + slave.read((char *)buf_rcv,bufSize); if (verbose){ pc.printf("\n\r Incoming buffer(hex): \n\r"); int j; @@ -117,8 +84,7 @@ pc.printf("%x", buf_rcv[j]); pc.printf(" "); } - } -*/ + } return I2C_READ; default: }; //switch