sakthi priya amirtharaj / Mbed 2 deprecated master_1

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
sakthipriya
Date:
Sun Dec 07 07:39:35 2014 +0000
Parent:
0:545d40142697
Commit message:
commands using switch case

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Sat Dec 06 13:01:02 2014 +0000
+++ b/main.cpp	Sun Dec 07 07:39:35 2014 +0000
@@ -18,17 +18,15 @@
          *command=pc.getc();                //characters 0 to 4 are assumed to be commands
          printf("\n command detected\n\r");
          m2s_interrupt =1; 
-         bool write_loop =1; 
          bool master_status_write = true;
-         while(write_loop){
-                master.frequency(100000);                       //set clock frequency
-                master.start();                                 //initiating the data transfer
+         master.frequency(100000); 
+         while(master_status_write)
+         {
+                master.start(); 
                 master_status_write = (bool) master.write(addr|0x00,command,1);
-                if(!master_status_write){
-                    printf("command %c sent to slave\n\r",*command);
-                    write_loop=false;
-                }
-        }
-        delete command;
+                printf("\n master trying to write \n\r");
+         }
+         printf("command %c sent to slave\n\r",*command);
+         delete command;
     }
 }
\ No newline at end of file