Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gsionek
Date:
Tue Apr 24 16:16:16 2012 +0000
Parent:
0:7ccc94242357
Commit message:

Changed in this revision

i2c_test.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 7ccc94242357 -r ef7be3d55009 i2c_test.cpp
--- a/i2c_test.cpp	Tue Apr 24 15:50:08 2012 +0000
+++ b/i2c_test.cpp	Tue Apr 24 16:16:16 2012 +0000
@@ -1,5 +1,7 @@
 #include "i2c_test.h"
 
+Semaphore sem(0);
+
 I2C i2cMaster(p28, p27);
 I2CSlave i2cSlave(p9,p10);
 
@@ -22,7 +24,9 @@
     //wait(5);
     //do{
     //printf("ha\n\r");
-    //}while(attente == 0);
+    //}
+    //while(attente == 0);
+    sem.wait();
     printf("helo2\n\r");
 }
 
@@ -38,7 +42,8 @@
     i2cMaster.read(spiAddr, buf, sizeof(buf));
     if( !strcmp(buf, "MASTER SLAVE") )   printf("TESTE DE PUTE OK\n\r");
     
-    attente++;
+    sem.release();
+    attente = 1;
     pute = 0;
     printf("helo3\n\r");
 }