programme ines avce xbee

Dependencies:   MMA8451Q mbed xbee_lib

Fork of Programme_course by Freescale_Cachan

Committer:
Freescale_cup
Date:
Thu Jan 26 07:37:45 2017 +0000
Revision:
0:3ec7fc598e48
Programme de base

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Freescale_cup 0:3ec7fc598e48 1 #include "Mlib.h"
Freescale_cup 0:3ec7fc598e48 2
Freescale_cup 0:3ec7fc598e48 3 /****************CAMERA****************/
Freescale_cup 0:3ec7fc598e48 4 void F_GetData()
Freescale_cup 0:3ec7fc598e48 5 {
Freescale_cup 0:3ec7fc598e48 6 timer.reset();
Freescale_cup 0:3ec7fc598e48 7 begin = timer.read_us();
Freescale_cup 0:3ec7fc598e48 8 SI = 0;
Freescale_cup 0:3ec7fc598e48 9 char numero_data = 0;
Freescale_cup 0:3ec7fc598e48 10 while(timer.read_us() < begin+tempsInte);
Freescale_cup 0:3ec7fc598e48 11 clk_active = 1;
Freescale_cup 0:3ec7fc598e48 12 Impulse_SI();
Freescale_cup 0:3ec7fc598e48 13 while(CLK.read() == 0);
Freescale_cup 0:3ec7fc598e48 14 cam_data[0] = AIN.read_u16()>>8;
Freescale_cup 0:3ec7fc598e48 15 while(CLK.read() == 1);
Freescale_cup 0:3ec7fc598e48 16
Freescale_cup 0:3ec7fc598e48 17 for(numero_data = 1; numero_data < 128; numero_data++)
Freescale_cup 0:3ec7fc598e48 18 {
Freescale_cup 0:3ec7fc598e48 19 while(CLK.read() == 0);//On attends le front montant
Freescale_cup 0:3ec7fc598e48 20 cam_data[numero_data] = AIN.read_u16()>>8;//mémorisation des données
Freescale_cup 0:3ec7fc598e48 21 while(CLK.read() == 1);//on attends le front descendant
Freescale_cup 0:3ec7fc598e48 22 }
Freescale_cup 0:3ec7fc598e48 23
Freescale_cup 0:3ec7fc598e48 24 clk_active = 0;
Freescale_cup 0:3ec7fc598e48 25 SI = 1;
Freescale_cup 0:3ec7fc598e48 26
Freescale_cup 0:3ec7fc598e48 27 }
Freescale_cup 0:3ec7fc598e48 28
Freescale_cup 0:3ec7fc598e48 29 void F_CLK()
Freescale_cup 0:3ec7fc598e48 30 {
Freescale_cup 0:3ec7fc598e48 31 if(clk_active)
Freescale_cup 0:3ec7fc598e48 32 {
Freescale_cup 0:3ec7fc598e48 33 CLK = 1-CLK;
Freescale_cup 0:3ec7fc598e48 34 }
Freescale_cup 0:3ec7fc598e48 35 }
Freescale_cup 0:3ec7fc598e48 36
Freescale_cup 0:3ec7fc598e48 37 void Impulse_SI()
Freescale_cup 0:3ec7fc598e48 38 {
Freescale_cup 0:3ec7fc598e48 39 while(CLK == 0);
Freescale_cup 0:3ec7fc598e48 40 while(CLK == 1);
Freescale_cup 0:3ec7fc598e48 41 SI = 1;
Freescale_cup 0:3ec7fc598e48 42 while(CLK == 0);
Freescale_cup 0:3ec7fc598e48 43 SI = 0;
Freescale_cup 0:3ec7fc598e48 44 }