update credits
[librepilot.git] / flight / targets / boards / oplinkmini / firmware / oplink.c
blob13b5e44b34fdbc4bba972f2fd71c6c19fb50b9a3
1 /**
2 ******************************************************************************
3 * @addtogroup OpenPilotSystem OpenPilot System
4 * @brief These files are the core system files of OpenPilot.
5 * They are the ground layer just above PiOS. In practice, OpenPilot actually starts
6 * in the main() function of openpilot.c
7 * @{
8 * @addtogroup OpenPilotCore OpenPilot Core
9 * @brief This is where the OP firmware starts. Those files also define the compile-time
10 * options of the firmware.
11 * @{
12 * @file openpilot.c
13 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
14 * @brief Sets up and runs main OpenPilot tasks.
15 * @see The GNU Public License (GPL) Version 3
17 *****************************************************************************/
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 3 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful, but
25 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
26 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
27 * for more details.
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
34 #include "inc/openpilot.h"
35 #include <uavobjectsinit.h>
36 #include <hwsettings.h>
37 #include <pios_board_init.h>
39 /* Task Priorities */
40 #define PRIORITY_TASK_HOOKS (tskIDLE_PRIORITY + 3)
42 /* Global Variables */
44 extern void Stack_Change(void);
46 /**
47 * OpenPilot Main function:
49 * Initialize PiOS<BR>
50 * Create the "System" task (SystemModInitializein Modules/System/systemmod.c) <BR>
51 * Start FreeRTOS Scheduler (vTaskStartScheduler) (Now handled by caller)
52 * If something goes wrong, blink LED1 and LED2 every 100ms
55 int main()
57 /* NOTE: Do NOT modify the following start-up sequence */
58 /* Any new initialization functions should be added in OpenPilotInit() */
60 /* Brings up System using CMSIS functions, enables the LEDs. */
61 PIOS_SYS_Init();
63 /* Architecture dependant Hardware and
64 * core subsystem initialisation
65 * (see pios_board.c for your arch)
66 * */
67 PIOS_Board_Init();
69 /* Initialize modules */
70 MODULE_INITIALISE_ALL
71 /* swap the stack to use the IRQ stack */
72 Stack_Change();
74 /* Start the FreeRTOS scheduler which should never returns.*/
75 vTaskStartScheduler();
77 /* If all is well we will never reach here as the scheduler will now be running. */
79 /* Do some indication to user that something bad just happened */
80 while (1) {
81 #if defined(PIOS_LED_HEARTBEAT)
82 PIOS_LED_Toggle(PIOS_LED_HEARTBEAT);
83 #endif /* PIOS_LED_HEARTBEAT */
84 PIOS_DELAY_WaitmS(100);
87 return 0;
90 /**
91 * @}
92 * @}