2010-08-04 11:37:09 +02:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file pipbee.c
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* @brief Main PipBee functions
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
2010-08-21 22:01:37 +02:00
|
|
|
*
|
2010-08-04 11:37:09 +02:00
|
|
|
*****************************************************************************/
|
2010-08-21 22:01:37 +02:00
|
|
|
/*
|
|
|
|
* This program 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 3 of the License, or
|
2010-08-04 11:37:09 +02:00
|
|
|
* (at your option) any later version.
|
2010-08-21 22:01:37 +02:00
|
|
|
*
|
|
|
|
* This program 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
|
2010-08-04 11:37:09 +02:00
|
|
|
* for more details.
|
2010-08-21 22:01:37 +02:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
2010-08-04 11:37:09 +02:00
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
2010-08-21 20:14:18 +02:00
|
|
|
//*****************************************************************************
|
|
|
|
// OpenPilot Includes
|
|
|
|
|
2010-08-04 11:37:09 +02:00
|
|
|
#include "pipbee.h"
|
|
|
|
|
2010-08-21 20:14:18 +02:00
|
|
|
//*****************************************************************************
|
|
|
|
// Global Variables
|
2010-08-04 11:37:09 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-08-21 20:14:18 +02:00
|
|
|
//*****************************************************************************
|
|
|
|
// Local Variables
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// Function Prototypes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//*****************************************************************************
|
|
|
|
// Main function
|
|
|
|
|
2010-08-04 11:37:09 +02:00
|
|
|
int main()
|
|
|
|
{
|
2010-08-21 20:14:18 +02:00
|
|
|
// *************
|
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
// Brings up System using CMSIS functions, enables the LEDs.
|
|
|
|
PIOS_SYS_Init();
|
2010-08-21 22:01:37 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
// Delay system
|
|
|
|
PIOS_DELAY_Init();
|
2010-08-21 22:01:37 +02:00
|
|
|
|
2010-08-21 19:14:34 +02:00
|
|
|
// UART communication system
|
2010-08-22 10:59:00 +02:00
|
|
|
PIOS_COM_Init();
|
2010-08-21 22:01:37 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
// ADC system
|
|
|
|
PIOS_ADC_Init();
|
2010-08-21 22:01:37 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
// SPI link to master
|
|
|
|
PIOS_SPI_Init();
|
2010-08-21 19:14:34 +02:00
|
|
|
|
2010-08-21 20:14:18 +02:00
|
|
|
CLEAR_RTS;
|
|
|
|
|
2010-08-21 19:14:34 +02:00
|
|
|
// *************
|
2010-08-21 20:14:18 +02:00
|
|
|
// do a simple visible LED flash sequence for the user
|
|
|
|
|
|
|
|
USB_LED_OFF;
|
|
|
|
LINK_LED_OFF;
|
|
|
|
RX_LED_OFF;
|
|
|
|
TX_LED_OFF;
|
2010-08-21 19:14:34 +02:00
|
|
|
|
|
|
|
for (int i = 0; i < 2; i++)
|
|
|
|
{
|
2010-08-21 20:14:18 +02:00
|
|
|
USB_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
LINK_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
RX_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
TX_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
|
|
|
}
|
2010-08-21 20:14:18 +02:00
|
|
|
|
2010-08-21 19:14:34 +02:00
|
|
|
// *************
|
2010-08-21 20:14:18 +02:00
|
|
|
// Main executive loop
|
2010-08-21 19:14:34 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
while (1)
|
|
|
|
{
|
2010-08-21 19:14:34 +02:00
|
|
|
/* uint32_t loop_ctr;
|
|
|
|
|
|
|
|
if (++loop_ctr >= 10000000)
|
2010-08-04 19:35:48 +02:00
|
|
|
{
|
|
|
|
loop_ctr = 0;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_LED_Toggle(LED2);
|
2010-08-04 19:35:48 +02:00
|
|
|
}
|
2010-08-21 19:14:34 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
// just sequence the LED's for now
|
2010-08-21 20:14:18 +02:00
|
|
|
USB_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
LINK_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
RX_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
TX_LED_TOGGLE;
|
2010-08-21 19:14:34 +02:00
|
|
|
PIOS_DELAY_WaitmS(200);
|
2010-08-21 20:14:18 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
}
|
2010-08-21 22:01:37 +02:00
|
|
|
|
2010-08-04 19:35:48 +02:00
|
|
|
return 0;
|
2010-08-04 11:37:09 +02:00
|
|
|
}
|
2010-08-21 20:14:18 +02:00
|
|
|
|
|
|
|
//*****************************************************************************
|