Paparazzi UAS  v5.12_stable-4-g9b43e9b
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
bluegiga.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2015 Kirk Scheper <kirkscheper@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, see
18  * <http://www.gnu.org/licenses/>.
19  *
20  */
21 
27 #ifndef BLUEGIGA_DATA_LINK_H
28 #define BLUEGIGA_DATA_LINK_H
29 
30 #include "pprzlink/pprzlink_device.h"
31 #include "pprzlink/pprz_transport.h"
33 
34 /* The different statuses the communication can be in */
40 };
41 
42 #ifndef BLUEGIGA_BUFFER_SIZE
43 #define BLUEGIGA_BUFFER_SIZE 256 // buffer max value: 256
44 #elif BLUEGIGA_BUFFER_SIZE < 256
45 #warning "BLUEGIGA_BUFFER_SIZE may be smaller than possible message length, check subsystems/datalink/bluegiga.c:dev_check_free_space for more information"
46 #elif BLUEGIGA_BUFFER_SIZE > 256
47 #error "BLUEGIGA_BUFFER_SIZE not made for sizes larger than 256, check subsystems/datalink/bluegiga.c for more information"
48 #endif
49 
50 #define BLUEGIGA_SPI_BUF_SIZE 20
51 
53  /* Receive buffer */
57  /* Transmit buffer */
61  /* transmit and receive buffers */
65  struct link_device device;
66 
67  /* some administrative variables */
71 
72 };
73 
74 // DEVICE passed to all DOWNLINK_SEND functions
75 extern struct bluegiga_periph bluegiga_p;
76 extern signed char bluegiga_rssi[]; // values initialized with 127
77 
79 void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len);
80 
81 void bluegiga_init(struct bluegiga_periph *p);
82 void bluegiga_scan(struct bluegiga_periph *p);
83 void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len);
84 
85 #endif /* BLUEGIGA_DATA_LINK_H */
bool bluegiga_ch_available(struct bluegiga_periph *p)
Definition: bluegiga.c:116
uint8_t work_tx[BLUEGIGA_SPI_BUF_SIZE]
Definition: bluegiga.h:62
struct link_device device
Generic device interface.
Definition: bluegiga.h:65
#define BLUEGIGA_BUFFER_SIZE
Definition: bluegiga.h:43
uint8_t work_rx[BLUEGIGA_SPI_BUF_SIZE]
Definition: bluegiga.h:63
void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len)
Definition: bluegiga.c:122
The com is sending.
Definition: bluegiga.h:38
BlueGigaStatus
Definition: bluegiga.h:35
uint8_t connected
Definition: bluegiga.h:70
uint8_t rx_buf[BLUEGIGA_BUFFER_SIZE]
Definition: bluegiga.h:54
uint8_t tx_extract_idx
Definition: bluegiga.h:60
void bluegiga_scan(struct bluegiga_periph *p)
The com is switched from data link to rssi scanning.
Definition: bluegiga.h:39
uint8_t tx_insert_idx
Definition: bluegiga.h:59
uint32_t bytes_recvd_since_last
Definition: bluegiga.h:68
struct bluegiga_periph bluegiga_p
Definition: bluegiga.c:61
signed char bluegiga_rssi[]
void bluegiga_init(struct bluegiga_periph *p)
Definition: bluegiga.c:148
unsigned long uint32_t
Definition: types.h:18
uint8_t tx_buf[BLUEGIGA_BUFFER_SIZE]
Definition: bluegiga.h:58
void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len)
Definition: bluegiga.c:343
uint8_t rx_extract_idx
Definition: bluegiga.h:56
unsigned char uint8_t
Definition: types.h:14
The com isn't initialized.
Definition: bluegiga.h:36
#define BLUEGIGA_SPI_BUF_SIZE
Definition: bluegiga.h:50
static float p[2][2]
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
The com is in idle.
Definition: bluegiga.h:37
uint8_t rx_insert_idx
Definition: bluegiga.h:55
uint8_t end_of_msg
Definition: bluegiga.h:69