Seeker of Truth , / Mbed 2 deprecated master_sample

Dependencies:   mbed-rtos mbed

Fork of master_sample by sakthi priya amirtharaj

Revision:
0:b2ba86a47999
Child:
1:d4903940ac9b
diff -r 000000000000 -r b2ba86a47999 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sat Dec 06 07:31:05 2014 +0000
@@ -0,0 +1,49 @@
+#include "mbed.h"
+
+#define interrupt D8
+
+const int addr = 0x20;                     //slave address 
+I2C master (D14,D15);                      //configure pins p27,p28 as I2C master
+Serial pc(USBTX,USBRX);
+DigitalOut m2s_interrupt(interrupt);
+
+int main()
+{
+    char* data_send =  new char;
+    *data_send = 'b';
+     char *data_rec =  new char;
+    *data_rec = 'b';
+    m2s_interrupt=0;
+    while(1){
+      bool write_loop = true;
+     //printf("m2s_interrupt is 0");
+     printf("\npress a for master to start \n\r");
+     m2s_interrupt=0;
+    if(pc.getc()=='a'){
+            printf("\n backspace detected\n\r");
+            m2s_interrupt =1;          //hardware interrupt from master to slave  
+            wait(10);         
+            bool master_status_write = true;
+            //bool master_status_read = true;
+            
+            
+           
+           // bool read_loop = true;
+            /*while(write_loop){
+                printf("2 master clk freq setup and addressing slave\n\r");
+                master.frequency(100000);                       //set clock frequency
+                master.start();                                 //initiating the data transfer
+                master_status_write = (bool) master.write(addr|0x00,data_send,1);
+                if(!master_status_write){
+                    printf("3 master has written %c to slave\n\r",*data_send);
+                    write_loop=false;
+                }
+            }*/
+            
+            printf("done\n\r");
+        }}
+}
+            
+            
+            
+                   
\ No newline at end of file