Paparazzi UAS v7.0_unstable
Paparazzi is a free software Unmanned Aircraft System.
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
protocol.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2014 OpenUAS
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, write to
18 * the Free Software Foundation, 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
20 *
21 */
22
37#ifndef MORA_TRANSPORT_H
38#define MORA_TRANSPORT_H
39
40#include <inttypes.h>
41#include <stdbool.h>
42#include "std.h"
43
45// MESSAGES
46
47#define MORA_SHOOT 1
48#define MORA_SHOOT_MSG_SIZE (4*10)
49
50// 7 * 4 bytes int32_t
51// nr, lat, lon, h, phi, theta, psi
52
54 struct {
55 int32_t nr;
56 int32_t lat;
57 int32_t lon;
58 int32_t alt;
59 int32_t phi;
60 int32_t theta;
61 int32_t psi;
62 int32_t vground;
64 int32_t groundalt;
68};
69
70#define MORA_BUFFER_EMPTY 2
71
72// 0 bytes payload: null
73
74#define MORA_PAYLOAD 3
75#define MORA_PAYLOAD_MSG_SIZE 70
76
77
78// 72 bytes
79
80#define MORA_STATUS 4
81#define MORA_STATUS_MSG_SIZE (4*2)
82
83// 4*2 bytes
93
95// SENDING
96
98
99#define STX 0x99
100
101#define MoraSizeOf(_payload) (_payload+5)
102
103#define MoraPutUint8( _byte) { \
104 mora_ck_a += _byte; \
105 mora_ck_b += mora_ck_a; \
106 CameraLinkTransmit(_byte); \
107 }
108
109#define MoraHeader(msg_id, payload_len) { \
110 CameraLinkTransmit(STX); \
111 uint8_t msg_len = MoraSizeOf( payload_len); \
112 CameraLinkTransmit(msg_len); \
113 mora_ck_a = msg_len; mora_ck_b = msg_len; \
114 MoraPutUint8(msg_id); \
115 }
116
117#define MoraTrailer() { \
118 CameraLinkTransmit(mora_ck_a); \
119 CameraLinkTransmit(mora_ck_b); \
120 }
121
122#define MoraPut1ByteByAddr( _byte) { \
123 uint8_t _x = *(_byte); \
124 MoraPutUint8( _x); \
125 }
126
128// PARSING
129
131 // generic interface
137 // specific pprz transport variables
141};
142
143extern struct mora_transport mora_protocol;
144
145void parse_mora(struct mora_transport *t, uint8_t c);
146
147
148#endif
149
static int16_t course[3]
uint8_t payload_len
Definition protocol.h:136
#define MORA_STATUS_MSG_SIZE
Definition protocol.h:81
uint8_t mora_ck_a
Definition protocol.c:5
struct dc_shot_union::@293 data
uint8_t payload[256]
Definition protocol.h:132
void parse_mora(struct mora_transport *t, uint8_t c)
Definition protocol.c:20
uint8_t ck_b
Definition protocol.h:140
#define MORA_SHOOT_MSG_SIZE
Definition protocol.h:48
uint8_t mora_ck_b
Definition protocol.h:97
uint8_t msg_id
Definition protocol.h:134
uint8_t bin[MORA_SHOOT_MSG_SIZE]
Definition protocol.h:66
uint8_t error
Definition protocol.h:133
int32_t i[10]
Definition protocol.h:67
uint8_t ck_a
Definition protocol.h:140
bool msg_received
Definition protocol.h:135
struct mora_status_union::mora_status_struct data
uint8_t bin[MORA_STATUS_MSG_SIZE]
Definition protocol.h:91
struct mora_transport mora_protocol
Definition protocol.c:18
uint8_t payload_idx
Definition protocol.h:139
uint8_t status
Definition protocol.h:138
uint16_t foo
Definition main_demo5.c:58
unsigned short uint16_t
Typedef defining 16 bit unsigned short type.
int int32_t
Typedef defining 32 bit int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.