Dependencies: mbed
Diff: main.cpp
- Revision:
- 0:1b0dce2e60ba
diff -r 000000000000 -r 1b0dce2e60ba main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/main.cpp Mon Dec 01 21:24:13 2014 +0000 @@ -0,0 +1,59 @@ +#include "main.h" + + +//VOIR LA PRIORITE DES INTERRUPTIONS +//INTERRUPTION SUR LES CLICKS DES CAPTEURS DE VITESSE DOIT AVOIR UNE PRIORITE PLUS IMPORTANTE +//QUE LA CAMERA OU LE RESTE + +// COMMANDE: 53 43 FF FF FF 0A +// Freescale de merde + +Propulsion propulsion; +DigitalOut led_run(LED_RED); +Camera cam(P_SI,P_CLK,P_AO,5); +Ticker timer; +Timer t; +int begin,end; +int t_int; +bool acquisition; + +unsigned short valeurs[128]; + +void call() { + acquisition = true; +} + +void setTIntegration(int t) +{ + timer.detach(); + timer.attach_us(&call,t); +} + +//TEMPS INTEGRATION 0.065-100 ms +int main() +{ + init(); + t.start(); + acquisition = false; + t_int = 10000; + timer.attach_us(&call,t_int); + //testPropulsion2(); + + /*Attente active !! Argh ! */ + + /*Ou est ce que tu vois une attente active, il n'y a qu'un pauvre vieux test a chaque passage*/ + /*De plus, je te paie une bière si tu me codes un OS pour Freescale qui me gère la préemption et le réveil de Thread*/ + + while (true) { + if(acquisition) { + led_run = !led_run; + + //Lancement acquisition + begin = t.read_us(); + cam.capture(valeurs); + end = t.read_us(); + + acquisition = false; + } + } +}