Paparazzi UAS  v5.15_devel-61-g9c6bcf9
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
superbitrf.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2013 Freek van Tienen <freek.v.tienen@gmail.com>
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 
27 #ifndef DATALINK_SUPERBITRF_H
28 #define DATALINK_SUPERBITRF_H
29 
30 #include "mcu_periph/gpio.h"
31 #include "peripherals/cyrf6936.h"
32 #include "pprzlink/pprzlink_device.h"
33 #include "pprzlink/pprz_transport.h"
35 
36 /* The timings in microseconds */
37 #define SUPERBITRF_BIND_RECV_TIME 10000
38 #define SUPERBITRF_SYNC_RECV_TIME 7000
39 #define SUPERBITRF_RECV_TIME 20000
40 #define SUPERBITRF_RECV_SHORT_TIME 6000
41 #define SUPERBITRF_DATARECV_TIME 10000
42 #define SUPERBITRF_DATARECVB_TIME 6000
44 /* The different statuses the superbitRF can be in */
53 };
54 
55 /* The different resolutions a transmitter can be in */
59 };
60 
61 /* The different protocols a transmitter can send */
63  DSM_DSM2_1 = 0x01,
64  DSM_DSM2_2 = 0x02,
65  DSM_DSM2P = 0x10,
66  DSM_DSMXP = 0x11,
67  DSM_DSMX_1 = 0xA2,
68  DSM_DSMX_2 = 0xB2,
69 };
70 #define IS_DSM2(x) (x == DSM_DSM2P || x == DSM_DSM2_1 || x == DSM_DSM2_2)
71 #define IS_DSMX(x) (!IS_DSM2(x))
72 
73 #define SUPERBITRF_TX_BUFFER_SIZE 128
74 
75 /* The superbitrf structure */
76 struct SuperbitRF {
77  struct Cyrf6936 cyrf6936;
78  volatile enum SuperbitRFStatus status;
86  bool packet_loss;
97  uint8_t bind_mfg_id[4];
100  volatile enum dsm_protocol protocol;
101  volatile enum dsm_resolution resolution;
111  struct pprz_transport rx_transport;
118  struct link_device device;
119 };
120 
121 /* The superbitrf functions and structures */
122 extern struct SuperbitRF superbitrf;
123 extern void superbitrf_init(void);
124 extern void superbitrf_event(void);
125 extern void superbitrf_dl_init(void);
126 extern void superbitrf_dl_event(void);
127 extern void superbitrf_set_mfg_id(uint32_t id);
129 
130 /* The pprz transport structure */
131 extern struct pprz_transport pprz_srf_tp;
132 
133 #endif /* DATALINK_SUPERBITRF_H */
Driver for the cyrf6936 2.4GHz radio chip.
unsigned short uint16_t
Definition: types.h:16
Some architecture independent helper functions for GPIOs.
unsigned long uint32_t
Definition: types.h:18
signed short int16_t
Definition: types.h:17
unsigned char uint8_t
Definition: types.h:14