Paparazzi UAS
v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
xbee_dl.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2016 Gautier Hattenberger <gautier.hattenberger@enac.fr>
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
*/
21
26
#include "
modules/datalink/xbee_dl.h
"
27
#include "
modules/datalink/datalink.h
"
28
#include "
mcu.h
"
29
#include "
mcu_periph/sys_time.h
"
30
#include "
mcu_periph/uart.h
"
31
#include "generated/airframe.h"
32
33
#if USE_TUNNEL_UAVCAN
34
#include "
modules/datalink/tunnel_uavcan.h
"
35
#endif
36
37
#define STR_(s) #s
38
#define STR(s) STR_(s)
39
40
#ifndef XBEE_TYPE
41
#define XBEE_TYPE XBEE_24
42
#endif
43
#ifndef XBEE_INIT
44
#define XBEE_INIT ""
45
#endif
46
47
#ifdef XBEE_CHANNEL
48
#define XBEE_CHANNEL_CONF "ATCH" STR(XBEE_CHANNEL) "\r"
49
INFO
(
"XBEE channel configured : "
XBEE_CHANNEL_CONF
)
50
#else
51
#define XBEE_CHANNEL_CONF ""
52
#endif
53
54
#define CONCAT(a, b) a b
55
56
#ifndef XBEE_UPDATE_DL
57
#define XBEE_UPDATE_DL TRUE
58
#endif
59
60
struct
xbee_transport
xbee_tp
;
61
62
void
xbee_dl_init
(
void
)
63
{
64
#if USE_HARD_FAULT_RECOVERY
65
if
(
recovering_from_hard_fault
)
66
// in case of hardfault recovery, we want to skip xbee init which as an active wait
67
xbee_transport_init
(&
xbee_tp
, &((
XBEE_UART
).device),
AC_ID
,
XBEE_TYPE
,
XBEE_BAUD
,
NULL
,
CONCAT
(
XBEE_INIT
,
XBEE_CHANNEL_CONF
));
68
else
69
#endif
70
xbee_transport_init
(&
xbee_tp
, &((
XBEE_UART
).device),
AC_ID
,
XBEE_TYPE
,
XBEE_BAUD
,
sys_time_usleep
,
CONCAT
(
XBEE_INIT
,
XBEE_CHANNEL_CONF
));
71
}
72
73
void
xbee_dl_event
(
void
)
74
{
75
xbee_check_and_parse
(&(
XBEE_UART
).device, &
xbee_tp
,
datalink_get_buffer
(), &
dl_msg_available
);
76
DlCheckAndParse
(&(
XBEE_UART
).device, &
xbee_tp
.trans_tx,
datalink_get_buffer
(), &
dl_msg_available
,
XBEE_UPDATE_DL
);
77
}
78
sys_time_usleep
void sys_time_usleep(uint32_t us)
sys_time_usleep(uint32_t us)
Definition
sys_time_arch.c:118
datalink_get_buffer
uint8_t * datalink_get_buffer(void)
get datalink buffer address
Definition
datalink.c:71
datalink.h
Handling of messages coming from ground and other A/Cs.
DlCheckAndParse
static void DlCheckAndParse(struct link_device *dev, struct transport_tx *trans, uint8_t *buf, bool *msg_available, bool update_dl)
Check for new message and parse.
Definition
datalink.h:72
dl_msg_available
bool dl_msg_available
Flag provided to control calls to dl_parse_msg.
Definition
main_demo5.c:60
foo
uint16_t foo
Definition
main_demo5.c:58
mcu.h
Arch independent mcu ( Micro Controller Unit ) utilities.
sys_time.h
Architecture independent timing functions.
tunnel_uavcan.h
uart.h
arch independent UART (Universal Asynchronous Receiver/Transmitter) API
XBEE_CHANNEL_CONF
#define XBEE_CHANNEL_CONF
Definition
xbee_dl.c:51
XBEE_TYPE
#define XBEE_TYPE
Definition
xbee_dl.c:41
xbee_tp
struct xbee_transport xbee_tp
XBEE transport structure.
Definition
xbee_dl.c:60
CONCAT
#define CONCAT(a, b)
Definition
xbee_dl.c:54
XBEE_INIT
#define XBEE_INIT
Definition
xbee_dl.c:44
XBEE_UPDATE_DL
#define XBEE_UPDATE_DL
Definition
xbee_dl.c:57
xbee_dl_init
void xbee_dl_init(void)
Init function.
Definition
xbee_dl.c:62
xbee_dl_event
void xbee_dl_event(void)
Datalink Event.
Definition
xbee_dl.c:73
xbee_dl.h
Datalink using XBEE protocol.
sw
airborne
modules
datalink
xbee_dl.c
Generated on Fri Aug 21 2026 11:53:59 for Paparazzi UAS by
1.9.8