Paparazzi UAS  v5.15_devel-164-g81d4ceb
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
crtp.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2019 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 
29 #ifndef CRTP_H
30 #define CRTP_H
31 
32 #include "std.h"
33 
34 #define CRTP_PORT_CONSOLE 0x00
35 #define CRTP_PORT_PARAM 0x02
36 #define CRTP_PORT_COMMANDER 0x03
37 #define CRTP_PORT_MEM 0x04
38 #define CRTP_PORT_LOG 0x05
39 
40 #define CRTP_PORT_PPRZLINK 0x09 // Non-standard port for transmitting pprzlink messages
41 
42 #define CRTP_PORT_PLATFORM 0x0D
43 #define CRTP_PORT_DEBUG 0x0E
44 #define CRTP_PORT_LINK 0x0F
45 
46 #define CRTP_NULL(x) (((x).header & 0xf3) == 0xf3)
47 
48 // 1 byte header + 31 bytes data = 32 (max ESB packet size)
49 // With the NRF51, this could be increased to ~250, but the Crazyradio PA uses a NRF24 which can't do this
50 #define CRTP_MAX_DATA_SIZE 31
51 
52 typedef struct {
53  uint8_t size; // Total size of this message, including the header (placed here to overlap with syslink length field)
54  union {
55  uint8_t header;
56  struct {
57  uint8_t channel : 2;
58  uint8_t link : 2;
59  uint8_t port : 4;
60  };
61  };
62 
64 } __attribute__((packed)) crtp_message_t;
65 
66 
67 typedef struct {
68  float roll; // -20 to 20
69  float pitch;
70  float yaw; // -150 to 150
73 
74 #endif
75 
unsigned short uint16_t
Definition: types.h:16
#define CRTP_MAX_DATA_SIZE
Definition: crtp.h:50
float yaw
Definition: crtp.h:70
float pitch
Definition: crtp.h:69
uint8_t size
Definition: crtp.h:53
float roll
Definition: crtp.h:68
uint16_t thrust
Definition: crtp.h:71
unsigned char uint8_t
Definition: types.h:14
static uint8_t channel
Definition: ADS8344.c:80