Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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;
65  } data;
67  int32_t i[10];
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
90  } data;
92 };
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 
143 extern struct mora_transport mora_protocol;
144 
145 void parse_mora(struct mora_transport *t, uint8_t c);
146 
147 
148 #endif
149 
c
VIC slots used for the LPC2148 define name e g gps UART1_VIC_SLOT e g modem SPI1_VIC_SLOT SPI1 in mcu_periph spi_arch c or spi_slave_hs_arch c(and some others not using the SPI peripheral yet..) I2C0_VIC_SLOT 8 mcu_periph/i2c_arch.c I2C1_VIC_SLOT 9 mcu_periph/i2c_arch.c USB_VIC_SLOT 10 usb
mora_status_union::mora_status_struct
Definition: protocol.h:85
mora_ck_a
uint8_t mora_ck_a
Definition: protocol.c:5
uint16_t
unsigned short uint16_t
Definition: types.h:16
mora_status_union::bin
uint8_t bin[MORA_STATUS_MSG_SIZE]
Definition: protocol.h:91
mora_transport::ck_a
uint8_t ck_a
Definition: protocol.h:140
mora_ck_b
uint8_t mora_ck_b
Definition: protocol.h:97
parse_mora
void parse_mora(struct mora_transport *t, uint8_t c)
Definition: protocol.c:20
mora_transport::msg_id
uint8_t msg_id
Definition: protocol.h:134
mora_status_union::mora_status_struct::extra
uint16_t extra
Definition: protocol.h:89
mora_status_union::mora_status_struct::shots
uint16_t shots
Definition: protocol.h:88
MORA_STATUS_MSG_SIZE
#define MORA_STATUS_MSG_SIZE
Definition: protocol.h:81
mora_status_union
Definition: protocol.h:84
mora_status_union::mora_status_struct::threads
uint16_t threads
Definition: protocol.h:87
std.h
mora_transport
Definition: protocol.h:130
mora_transport::payload
uint8_t payload[256]
Definition: protocol.h:132
MORA_SHOOT_MSG_SIZE
#define MORA_SHOOT_MSG_SIZE
Definition: protocol.h:48
mora_transport::payload_idx
uint8_t payload_idx
Definition: protocol.h:139
mora_transport::error
uint8_t error
Definition: protocol.h:133
uint8_t
unsigned char uint8_t
Definition: types.h:14
dc_shot_union::i
int32_t i[10]
Definition: protocol.h:67
dc_shot_union::data
struct dc_shot_union::@288 data
mora_protocol
struct mora_transport mora_protocol
Definition: protocol.c:18
mora_transport::msg_received
bool msg_received
Definition: protocol.h:135
course
static int16_t course[3]
Definition: airspeed_uADC.c:58
mora_transport::payload_len
uint8_t payload_len
Definition: protocol.h:136
int32_t
signed long int32_t
Definition: types.h:19
mora_transport::ck_b
uint8_t ck_b
Definition: protocol.h:140
dc_shot_union::bin
uint8_t bin[MORA_SHOOT_MSG_SIZE]
Definition: protocol.h:66
logger_uart_parse.nr
nr
Definition: logger_uart_parse.py:9
mora_status_union::mora_status_struct::cpu
uint16_t cpu
Definition: protocol.h:86
dc_shot_union
Definition: protocol.h:53
mora_status_union::data
struct mora_status_union::mora_status_struct data
inttypes.h
mora_transport::status
uint8_t status
Definition: protocol.h:138