programme ines avce xbee

Dependencies:   MMA8451Q mbed xbee_lib

Fork of Programme_course by Freescale_Cachan

Revision:
0:3ec7fc598e48
diff -r 000000000000 -r 3ec7fc598e48 camera.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/camera.cpp	Thu Jan 26 07:37:45 2017 +0000
@@ -0,0 +1,44 @@
+#include "Mlib.h"
+
+/****************CAMERA****************/
+void F_GetData()
+{
+    timer.reset();
+    begin = timer.read_us();
+    SI = 0;
+    char numero_data = 0;
+    while(timer.read_us() < begin+tempsInte);
+    clk_active = 1;
+    Impulse_SI();
+    while(CLK.read() == 0);
+    cam_data[0] = AIN.read_u16()>>8;
+    while(CLK.read() == 1);
+    
+    for(numero_data = 1; numero_data < 128; numero_data++)
+    {
+        while(CLK.read() == 0);//On attends le front montant
+        cam_data[numero_data] = AIN.read_u16()>>8;//mémorisation des données
+        while(CLK.read() == 1);//on attends le front descendant
+    }
+
+    clk_active = 0;
+    SI = 1;
+  
+}
+
+void F_CLK()
+{
+    if(clk_active)
+    {
+        CLK = 1-CLK;
+    }
+}
+
+void Impulse_SI()
+{
+    while(CLK == 0);
+    while(CLK == 1);
+    SI = 1;
+    while(CLK == 0);
+    SI = 0;
+}
\ No newline at end of file