Paparazzi UAS
v6.1.0_stable
Paparazzi is a free software Unmanned Aircraft System.
fbw_datalink.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Christophe De Wagter
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, see
18
* <http://www.gnu.org/licenses/>.
19
*/
20
29
#include "
firmwares/fixedwing/fbw_datalink.h
"
30
#include "
mcu_periph/uart.h
"
31
#include "
led.h
"
32
33
34
#define ModemLinkDevice (&(MODEM_LINK).device)
35
#define AutopilotLinkDevice (&(AUTOPILOT_LINK).device)
36
37
static
inline
void
autopilot_parse
(
char
c)
38
{
39
ModemLinkDevice
->put_byte(
ModemLinkDevice
->periph, 0, c);
40
}
41
42
static
inline
void
modem_parse
(
char
c)
43
{
44
AutopilotLinkDevice
->put_byte(
AutopilotLinkDevice
->periph, 0, c);
45
}
46
47
void
fbw_datalink_periodic
(
void
)
48
{
49
#ifdef MODEM_LINK_LED
50
LED_OFF
(MODEM_LINK_LED);
51
#endif
52
#ifdef AUTOPILOT_LINK_LED
53
LED_OFF
(AUTOPILOT_LINK_LED);
54
#endif
55
}
56
57
void
fbw_datalink_event
(
void
)
58
{
59
#ifdef MODEM_LINK_LED
60
if
(
ModemLinkDevice
->char_available(
ModemLinkDevice
->periph)) {
61
LED_ON
(MODEM_LINK_LED);
62
}
63
#endif
64
#ifdef AUTOPILOT_LINK_LED
65
if
(
AutopilotLinkDevice
->char_available(
AutopilotLinkDevice
->periph)) {
66
LED_ON
(AUTOPILOT_LINK_LED);
67
}
68
#endif
69
70
while
(
ModemLinkDevice
->char_available(
ModemLinkDevice
->periph))
71
modem_parse
(
ModemLinkDevice
->get_byte(
ModemLinkDevice
->periph));
72
73
while
(
AutopilotLinkDevice
->char_available(
AutopilotLinkDevice
->periph))
74
autopilot_parse
(
AutopilotLinkDevice
->get_byte(
AutopilotLinkDevice
->periph));
75
}
fbw_datalink_periodic
void fbw_datalink_periodic(void)
Definition:
fbw_datalink.c:47
ModemLinkDevice
#define ModemLinkDevice
Definition:
fbw_datalink.c:34
modem_parse
static void modem_parse(char c)
Definition:
fbw_datalink.c:42
LED_OFF
#define LED_OFF(i)
Definition:
led_hw.h:52
fbw_datalink.h
LED_ON
#define LED_ON(i)
Definition:
led_hw.h:51
fbw_datalink_event
void fbw_datalink_event(void)
Definition:
fbw_datalink.c:57
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
autopilot_parse
static void autopilot_parse(char c)
Definition:
fbw_datalink.c:37
led.h
arch independent LED (Light Emitting Diodes) API
AutopilotLinkDevice
#define AutopilotLinkDevice
Definition:
fbw_datalink.c:35
sw
airborne
firmwares
fixedwing
fbw_datalink.c
Generated on Tue Feb 1 2022 13:08:43 for Paparazzi UAS by
1.8.17