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
protocol.c
Go to the documentation of this file.
1
2
3
#include "
protocol.h
"
4
5
uint8_t
mora_ck_a
,
mora_ck_b
;
6
7
10
// PPRZ parsing state machine
11
#define UNINIT 0
12
#define GOT_STX 1
13
#define GOT_LENGTH 2
14
#define GOT_MSGID 3
15
#define GOT_PAYLOAD 4
16
#define GOT_CRC1 5
17
18
struct
mora_transport
mora_protocol
;
19
20
void
parse_mora
(
struct
mora_transport
*
t
,
uint8_t
c)
21
{
22
//printf("%02X %d %d\n",c, t->status, t->error);
23
24
switch
(
t
->status) {
25
case
UNINIT
:
26
if
(c ==
STX
) {
27
t
->
status
++;
28
}
29
break
;
30
case
GOT_STX
:
31
if
(
t
->msg_received) {
32
t
->error++;
33
goto
error
;
34
}
35
t
->payload_len = c - 5;
/* Counting STX, LENGTH and CRC1 and CRC2 */
36
t
->ck_a =
t
->ck_b = c;
37
t
->status++;
38
t
->payload_idx = 0;
39
break
;
40
case
GOT_LENGTH
:
41
t
->msg_id = c;
42
t
->ck_a += c;
t
->ck_b +=
t
->ck_a;
43
t
->status++;
44
if
(
t
->payload_len == 0) {
45
t
->status++;
46
}
47
break
;
48
case
GOT_MSGID
:
49
t
->payload[
t
->payload_idx] = c;
50
t
->ck_a += c;
t
->ck_b +=
t
->ck_a;
51
t
->payload_idx++;
52
if
(
t
->payload_idx ==
t
->payload_len) {
53
t
->status++;
54
}
55
break
;
56
case
GOT_PAYLOAD
:
57
if
(c !=
t
->ck_a) {
58
goto
error
;
59
}
60
t
->status++;
61
break
;
62
case
GOT_CRC1
:
63
if
(c !=
t
->ck_b) {
64
goto
error
;
65
}
66
t
->msg_received =
true
;
67
goto
restart
;
68
default
:
69
goto
error
;
70
}
71
return
;
72
error
:
73
t
->error++;
74
restart
:
75
t
->status =
UNINIT
;
76
return
;
77
}
20
void
parse_mora
(
struct
mora_transport
*
t
,
uint8_t
c) {
…
}
mora_transport::error
uint8_t error
Definition
protocol.h:133
STX
#define STX
Definition
protocol.h:99
mora_transport::status
uint8_t status
Definition
protocol.h:138
mora_transport
Definition
protocol.h:130
foo
uint16_t foo
Definition
main_demo5.c:58
mora_ck_a
uint8_t mora_ck_a
Definition
protocol.c:5
GOT_MSGID
#define GOT_MSGID
Definition
protocol.c:14
parse_mora
void parse_mora(struct mora_transport *t, uint8_t c)
Definition
protocol.c:20
GOT_STX
#define GOT_STX
Definition
protocol.c:12
GOT_PAYLOAD
#define GOT_PAYLOAD
Definition
protocol.c:15
mora_ck_b
uint8_t mora_ck_b
Definition
protocol.c:5
GOT_LENGTH
#define GOT_LENGTH
Definition
protocol.c:13
UNINIT
#define UNINIT
Receiving pprz messages.
Definition
protocol.c:11
GOT_CRC1
#define GOT_CRC1
Definition
protocol.c:16
mora_protocol
struct mora_transport mora_protocol
Definition
protocol.c:18
protocol.h
PX4IO interface protocol.
uint8_t
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.
Definition
vl53l1_types.h:98
sw
airborne
modules
digital_cam
catia
protocol.c
Generated on Fri Apr 4 2025 14:56:50 for Paparazzi UAS by
1.9.8