I2CRTOS Driver by Helmut Schmücker. Removed included mbed-rtos library to prevent multiple definition. Make sure to include mbed-rtos library in your program!
Fork of I2cRtosDriver by
Diff: I2CDriverTest02.h
- Revision:
- 6:5b98c902a659
- Parent:
- 4:eafa7efcd771
- Child:
- 11:8c1d44595620
--- a/I2CDriverTest02.h Sat Apr 20 11:56:35 2013 +0000 +++ b/I2CDriverTest02.h Sat Apr 20 20:06:44 2013 +0000 @@ -15,7 +15,6 @@ memset(rxMsg,0,len); if ( slv.receive() == I2CSlave::WriteAddressed) { slv.read(rxMsg, len); - //rMsg[len-1]=0; printf("thread %X received message as i2c slave: '%s'\n",Thread::gettid(),rxMsg); } else printf("Ouch slv rx failure\n"); @@ -32,7 +31,6 @@ static void mstTxMsg(I2CMasterRtos& mst) { mst.write(adr,mstMsg,len); - //printf("thread %X has sent the message\n",Thread::gettid()); } static void mstRxMsg(I2CMasterRtos& mst) @@ -76,22 +74,8 @@ Thread selftalk01(channel1,0,osPriorityAboveNormal); Thread selftalk02(channel2,0,osPriorityAboveNormal); - uint32_t cnt=0; - while (++cnt<5) { - const uint32_t dt=1e6; - uint32_t tStart = us_ticker_read(); - uint32_t tLast = tStart; - uint32_t tAct = tStart; - uint32_t tMe=0; - do { - tAct=us_ticker_read(); - if(tAct>tLast) { - if(tAct==tLast+1)++tMe; - } - tLast=tAct; - } while(tAct-tStart<dt); - printf("dc=%5.2f \n", 100.0*(float)tMe/dt); - } + Thread::wait(10000); + return 0; }