programme ines avce xbee

Dependencies:   MMA8451Q mbed xbee_lib

Fork of Programme_course by Freescale_Cachan

camera.cpp

Committer:
Freescale_cup
Date:
2017-01-26
Revision:
0:3ec7fc598e48

File content as of revision 0:3ec7fc598e48:

#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;
}