Files
paparazzi/sw/airborne/autopilot/mainloop.c
T
Antoine Drouin 9907c23028 This commit was generated by cvs2svn to compensate for changes in r2,
which included commits to RCS files with non-trunk default branches.
2005-01-25 10:57:55 +00:00

86 lines
1.9 KiB
C

/*
* $Id$
*
* Copyright (C) 2003 Pascal Brisset, Antoine Drouin
*
* This file is part of paparazzi.
*
* paparazzi is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* paparazzi is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with paparazzi; see the file COPYING. If not, write to
* the Free Software Foundation, 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*
*/
#include <avr/interrupt.h>
#include "std.h"
#include "timer.h"
#include "modem.h"
#include "adc.h"
#include "airframe.h"
#include "autopilot.h"
#include "spi.h"
#include "link_fbw.h"
#include "gps.h"
#include "nav.h"
#include "infrared.h"
#include "estimator.h"
#include "downlink.h"
int main( void ) {
/* init peripherals */
timer_init();
modem_init();
adc_init();
#ifdef CTL_BRD_V1_1
adc_buf_channel(ADC_CHANNEL_BAT, &buf_bat);
#endif
spi_init();
link_fbw_init();
gps_init();
nav_init();
ir_init();
estimator_init();
/* start interrupt task */
sei();
/* Wait 0.5s (for modem init ?) */
uint8_t init_cpt = 30;
while (init_cpt) {
if (timer_periodic())
init_cpt--;
}
/* enter mainloop */
while( 1 ) {
if(timer_periodic())
periodic_task();
if (gps_msg_received) {
parse_gps_msg();
gps_msg_received = FALSE;
if (gps_pos_available) {
use_gps_pos();
gps_pos_available = FALSE;
}
}
if (link_fbw_receive_complete) {
link_fbw_receive_complete = FALSE;
radio_control_task();
}
}
return 0;
}