Paparazzi UAS
v5.8.2_stable-0-g6260b7c
Paparazzi is a free software Unmanned Aircraft System.
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
main_chibios_libopencm3.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2013 Gautier Hattenberger, Alexandre Bustico
3
*
4
* This file is part of paparazzi.
5
*
6
* paparazzi is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* paparazzi is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
15
*
16
* You should have received a copy of the GNU General Public License
17
* along with paparazzi; see the file COPYING. If not, write to
18
* the Free Software Foundation, 59 Temple Place - Suite 330,
19
* Boston, MA 02111-1307, USA.
20
*/
21
26
#include "
firmwares/fixedwing/chibios-libopencm3/chibios_init.h
"
27
#include "
mcu_periph/sys_time.h
"
28
#include "chibios_stub.h"
29
#include "subsystems/chibios-libopencm3/chibios_sdlog.h"
30
#include "sdLog.h"
31
32
#ifdef FBW
33
#include "
firmwares/fixedwing/main_fbw.h
"
34
#define Fbw(f) f ## _fbw()
35
#else
36
#define Fbw(f)
37
#endif
38
39
#ifdef AP
40
#include "
firmwares/fixedwing/main_ap.h
"
41
#define Ap(f) f ## _ap()
42
#else
43
#define Ap(f)
44
#endif
45
46
#include "
led.h
"
47
48
49
static
int32_t
pprz_thd
(
void
*arg);
50
static
bool_t
sdlogOk
;
51
bool_t
pprzReady
=
FALSE
;
52
53
int
main
(
void
)
54
{
55
// Init
56
sys_time_init
();
57
58
// Init ChibiOS
59
sdlogOk
=
chibios_init
();
60
61
// Init PPRZ
62
Fbw
(
init
);
63
Ap
(
init
);
64
65
chibios_chThdSleepMilliseconds(100);
66
67
launch_pprz_thd
(&
pprz_thd
);
68
pprzReady
=
TRUE
;
69
// Call PPRZ periodic and event functions
70
while
(
TRUE
) {
71
chibios_chThdSleepMilliseconds(1000);
72
}
73
return
0;
74
}
75
76
77
static
int32_t
pprz_thd
(
void
*arg)
78
{
79
/*
80
To be compatible with rtos architecture, each of this 4 workers should
81
be implemented in differents threads, each of them waiting for job to be done:
82
periodic task should sleep, and event task should wait for event
83
*/
84
(void) arg;
85
chibios_chRegSetThreadName(
"pprz big loop"
);
86
87
while
(!chThdShouldTerminate()) {
88
Fbw
(
handle_periodic_tasks
);
89
Ap
(
handle_periodic_tasks
);
90
Fbw
(event_task);
91
Ap
(event_task);
92
chibios_chThdSleepMilliseconds(1);
93
}
94
95
return
0;
96
}
init
bool_t init
Definition:
nav_gls.c:57
main_ap.h
AP ( AutoPilot ) process API.
chibios_init.h
Fbw
#define Fbw(f)
Definition:
main_chibios_libopencm3.c:36
Ap
#define Ap(f)
Definition:
main_chibios_libopencm3.c:43
chibios_init
bool_t chibios_init(void)
Definition:
chibios_init.c:66
handle_periodic_tasks
STATIC_INLINE void handle_periodic_tasks(void)
Definition:
main.c:241
FALSE
#define FALSE
Definition:
std.h:5
TRUE
#define TRUE
Definition:
std.h:4
sys_time.h
Architecture independent timing functions.
sys_time_init
void sys_time_init(void)
Definition:
sys_time.c:73
int32_t
signed long int32_t
Definition:
types.h:19
pprzReady
bool_t pprzReady
Definition:
main_chibios_libopencm3.c:51
pprz_thd
static int32_t pprz_thd(void *arg)
Definition:
main_chibios_libopencm3.c:77
main
int main(void)
Definition:
main_chibios_libopencm3.c:53
launch_pprz_thd
void launch_pprz_thd(int32_t(*thd)(void *arg))
Definition:
chibios_init.c:81
sdlogOk
static bool_t sdlogOk
Definition:
main_chibios_libopencm3.c:50
led.h
arch independent LED (Light Emitting Diodes) API
main_fbw.h
FBW ( FlyByWire ) process API.
sw
airborne
firmwares
fixedwing
main_chibios_libopencm3.c
Generated on Tue Jun 21 2016 14:01:13 for Paparazzi UAS by
1.8.8