Paparazzi UAS
v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
Toggle main menu visibility
Main Page
Related Pages
Topics
Data Structures
Data Structures
Data Structure Index
Data Fields
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Enumerator
Files
File List
Globals
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
Variables
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Typedefs
a
b
c
d
e
f
g
h
i
j
m
n
p
r
s
t
u
v
w
Enumerations
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
v
w
z
Enumerator
a
b
c
d
e
f
g
h
i
j
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
Macros
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
y
z
•
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Modules
Pages
Loading...
Searching...
No Matches
rssi.c
Go to the documentation of this file.
1
/*
2
* Copyright (C) Kirk Scheper
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
*/
26
#include "
modules/multi/rssi.h
"
27
28
#include "
modules/datalink/datalink.h
"
29
#include "pprzlink/messages.h"
30
31
#include "
modules/core/abi.h
"
// rssi messages subscription
32
#include "generated/airframe.h"
// AC_ID
33
34
#ifndef NB_ACS_ID
35
#define NB_ACS_ID 256
36
#endif
37
#ifndef NB_ACS
38
#define NB_ACS 24
39
#endif
40
41
uint8_t
rssi_acs_idx
;
42
struct
rssi_info_
rssi_acs
[
NB_ACS
];
43
uint8_t
rssi_acs_id
[
NB_ACS_ID
];
44
45
abi_event
ev
;
46
47
static
void
rssi_cb
(
uint8_t
sender_id
__attribute__
((unused)),
uint8_t
_ac_id
,
int8_t
_tx_strength
,
int8_t
_rssi
)
48
{
49
set_rssi
(
_ac_id
,
_tx_strength
,
_rssi
);
50
}
47
static
void
rssi_cb
(
uint8_t
sender_id
__attribute__
((unused)),
uint8_t
_ac_id
,
int8_t
_tx_strength
,
int8_t
_rssi
) {
…
}
51
52
void
rssi_init
()
53
{
54
memset
(
rssi_acs_id
, 0,
NB_ACS_ID
);
55
56
rssi_acs_id
[0] = 0;
// ground station
57
rssi_acs_id
[
AC_ID
] = 1;
58
rssi_acs
[
rssi_acs_id
[
AC_ID
]].
ac_id
=
AC_ID
;
59
rssi_acs_idx
= 2;
60
61
/* register for rssi messages */
62
AbiBindMsgRSSI
(
ABI_BROADCAST
, &
ev
,
rssi_cb
);
63
}
52
void
rssi_init
() {
…
}
64
65
void
parse_rssi_dl
(
uint8_t
*buf)
66
{
67
uint8_t
sender_id
=
SenderIdOfPprzMsg
(buf);
68
uint8_t
msg_id =
IdOfPprzMsg
(buf);
69
70
if
(
sender_id
> 0 && msg_id ==
DL_RSSI
) {
71
set_rssi
(
sender_id
,
72
DL_RSSI_tx_power
(buf),
73
DL_RSSI_rssi
(buf));
74
}
75
}
65
void
parse_rssi_dl
(
uint8_t
*buf) {
…
}
76
77
void
set_rssi
(
uint8_t
_ac_id
,
int8_t
_tx_strength
,
int8_t
_rssi
)
78
{
79
if
(
rssi_acs_idx
<
NB_ACS
) {
80
if
(
_ac_id
> 0 &&
rssi_acs_id
[
_ac_id
] == 0) {
81
rssi_acs_id
[
_ac_id
] =
rssi_acs_idx
++;
82
rssi_acs
[
rssi_acs_id
[
_ac_id
]].
ac_id
=
_ac_id
;
83
}
84
85
rssi_acs
[
rssi_acs_id
[
_ac_id
]].
rssi
=
_rssi
;
86
rssi_acs
[
rssi_acs_id
[
_ac_id
]].
tx_strength
=
_tx_strength
;
87
}
88
}
77
void
set_rssi
(
uint8_t
_ac_id
,
int8_t
_tx_strength
,
int8_t
_rssi
) {
…
}
89
90
struct
rssi_info_
get_rssi
(
uint8_t
_ac_id
)
91
{
92
return
rssi_acs
[
rssi_acs_id
[
_ac_id
]];
93
}
90
struct
rssi_info_
get_rssi
(
uint8_t
_ac_id
) {
…
}
abi.h
Main include for ABI (AirBorneInterface).
ABI_BROADCAST
#define ABI_BROADCAST
Broadcast address.
Definition
abi_common.h:58
abi_struct
Event structure to store callbacks in a linked list.
Definition
abi_common.h:67
datalink.h
Handling of messages coming from ground and other A/Cs.
foo
uint16_t foo
Definition
main_demo5.c:58
ev
abi_event ev
Definition
rssi.c:45
rssi_cb
static void rssi_cb(uint8_t sender_id, uint8_t _ac_id, int8_t _tx_strength, int8_t _rssi)
Definition
rssi.c:47
get_rssi
struct rssi_info_ get_rssi(uint8_t _ac_id)
Definition
rssi.c:90
set_rssi
void set_rssi(uint8_t _ac_id, int8_t _tx_strength, int8_t _rssi)
Definition
rssi.c:77
rssi_init
void rssi_init()
Definition
rssi.c:52
rssi_acs_id
uint8_t rssi_acs_id[NB_ACS_ID]
Definition
rssi.c:43
rssi_acs_idx
uint8_t rssi_acs_idx
Definition
rssi.c:41
rssi_acs
struct rssi_info_ rssi_acs[NB_ACS]
Definition
rssi.c:42
parse_rssi_dl
void parse_rssi_dl(uint8_t *buf)
Definition
rssi.c:65
NB_ACS_ID
#define NB_ACS_ID
Definition
rssi.c:35
NB_ACS
#define NB_ACS
Definition
rssi.c:38
rssi.h
rssi_info_::rssi
int8_t rssi
Definition
rssi.h:33
rssi_acs_id
uint8_t rssi_acs_id[]
Definition
rssi.c:43
rssi_info_::ac_id
uint8_t ac_id
Definition
rssi.h:32
rssi_acs
struct rssi_info_ rssi_acs[]
Definition
rssi.c:42
rssi_info_::tx_strength
int8_t tx_strength
Definition
rssi.h:34
rssi_info_
Definition
rssi.h:31
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition
vl53l1_types.h:98
int8_t
signed char int8_t
Typedef defining 8 bit char type.
Definition
vl53l1_types.h:103
sw
airborne
modules
multi
rssi.c
Generated on Fri Apr 4 2025 14:56:51 for Paparazzi UAS by
1.9.8