Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
main_demo4.c
Go to the documentation of this file.
1
#include "
std.h
"
2
#include "
mcu.h
"
3
#include "
mcu_periph/sys_time.h
"
4
#include "
led.h
"
5
#include "
mcu_periph/uart.h
"
6
7
#include "pprzlink/messages.h"
8
#include "
modules/datalink/downlink.h
"
9
10
static
inline
void
main_init
(
void
);
11
static
inline
void
main_periodic_task
(
void
);
12
13
int
main
(
void
)
14
{
15
main_init
();
16
while
(1) {
17
if
(
sys_time_check_and_ack_timer
(0)) {
18
main_periodic_task
();
19
}
20
}
21
return
0;
22
}
23
24
static
inline
void
main_init
(
void
)
25
{
26
mcu_init
();
27
sys_time_register_timer
((1. / PERIODIC_FREQUENCY), NULL);
28
uart0_init_tx();
29
}
30
31
static
inline
void
main_periodic_task
(
void
)
32
{
33
LED_TOGGLE
(1);
34
uint16_t
time_sec =
sys_time
.
nb_sec
;
35
DOWNLINK_SEND_TAKEOFF(&time_sec);
36
}
LED_TOGGLE
#define LED_TOGGLE(i)
Definition:
led_hw.h:53
downlink.h
Common code for AP and FBW telemetry.
mcu_init
void mcu_init(void)
Microcontroller peripherals initialization.
Definition:
mcu.c:98
led.h
arch independent LED (Light Emitting Diodes) API
main_periodic_task
static void main_periodic_task(void)
Definition:
main_demo4.c:31
main
int main(void)
Definition:
main_demo4.c:13
main_init
static void main_init(void)
Definition:
main_demo4.c:24
mcu.h
Arch independent mcu ( Micro Controller Unit ) utilities.
std.h
sys_time_register_timer
tid_t sys_time_register_timer(float duration, sys_time_cb cb)
Register a new system timer.
Definition:
sys_time.c:43
sys_time.h
Architecture independent timing functions.
sys_time::nb_sec
volatile uint32_t nb_sec
full seconds since startup
Definition:
sys_time.h:72
sys_time_check_and_ack_timer
static bool sys_time_check_and_ack_timer(tid_t id)
Check if timer has elapsed.
Definition:
sys_time.h:123
sys_time
Definition:
sys_time.h:71
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
uint16_t
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
Definition:
vl53l1_types.h:88
sw
airborne
firmwares
tutorial
main_demo4.c
Generated on Thu Dec 5 2024 13:05:29 for Paparazzi UAS by
1.9.1