programme course avec menu amélioré

Dependencies:   MMA8451Q mbed

Fork of Programme_course_2 by Freescale_Cachan

camera.cpp

Committer:
leandre
Date:
2017-03-17
Revision:
2:a37de5eb8bf3
Parent:
0:3ec7fc598e48

File content as of revision 2:a37de5eb8bf3:

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