Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of CDMS_tc by
Revision 1:24c54d213671, committed 2014-12-20
- Comitter:
- sakthipriya
- Date:
- Sat Dec 20 06:05:33 2014 +0000
- Parent:
- 0:252ce694a71e
- Commit message:
- master working without tc
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r 252ce694a71e -r 24c54d213671 main.cpp --- a/main.cpp Wed Dec 17 12:49:58 2014 +0000 +++ b/main.cpp Sat Dec 20 06:05:33 2014 +0000 @@ -25,7 +25,7 @@ //while(1){ //interrupt = 0; // if(pc.getc()=='z'){ - wait(0.5); + //wait(0.5); interrupt = 1; printf("\nMaster executed\n"); @@ -55,7 +55,7 @@ }*/ - while(ack0) + while(ack0 && data_ready ==1 ) { //printf("2 master clk freq setup and addressing slave\n\r"); @@ -72,6 +72,7 @@ //printf("done\n\r"); //delete data; interrupt=0; + printf("\n blahblah\n\r"); } void T_I2C_MASTER_FSLAVE(void const *args) @@ -80,12 +81,15 @@ while(1) { Thread::signal_wait(0x1); + + FUNC_I2C_MASTER_FSLAVE(data_receive,25); /*i2c_data * i2c_data_r = i2c_data_receive.alloc(); strcpy(i2c_data_r->data , data_receive); i2c_data_r->length = 25; i2c_data_receive.put(i2c_data_r);*/ printf("\n Data received from slave is %s\n\r",data_receive); + } } @@ -121,7 +125,7 @@ i2c_data *i2c_data_s = (i2c_data*)evt.value.p; writedata = i2c_data_s -> data; master.frequency(100000); //set clock frequency - while(write2slave) + while(write2slave && interrupt ==1 ) { printf("master clk freq setup and addressing slave\n\r"); master.start(); //initiating the data transfer @@ -141,6 +145,7 @@ int main() { + interrupt=0; ptr_t_i2c = new Thread(T_I2C_MASTER_FSLAVE); data_ready.rise(&FUNC_INT); printf("\nstarted master\n");