#include <pic.h> 

#include "globals.h" 
#include "serial.h" 
#include "adc.h" 
#include "capture.h" 
#include "gpsrecv.h" 

#define EDAEMON_COMPILE 

#ifdef EDAEMON_COMPILE 
main() {
   unsigned int temperature0, temperature1;
   unsigned int x_pulse_width, x_period, y_pulse_width, y_period;
   
   setup_interrupts();
   serial_init();

   adc_init();
   capture_init();
   gps_init();
   
   RCIE = 1;
   PEIE = 1;
   GIE  = 1;
   CREN = 1;

   for (;;) {
      temperature0 = get_ad_immediate(0);
      temperature1 = get_ad_immediate(1);

      single_reading_two_axis(&x_pulse_width, &x_period, &y_pulse_width, &y_period);
      putstc("se");
      putdec(temperature0, 'h');
      putch(',');
      putdec(temperature1, 'h');
      putch(',');
      putdec(x_pulse_width, 'h');
      putch(',');
      putdec(x_period, 'h');
      putch(',');
      putdec(y_pulse_width, 'h');
      putch(',');
      putdec(y_period, 'h');
      putstc("es");
//      putlf();

/*
      putstc("gp");
      gps_gprmc();
      putstc("sp");
      putlf();
*/
   }
}
#endif