Paparazzi UAS  v5.10_stable-5-g83a0da5-dirty
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"
32 
33 /* The different statuses the communication can be in */
39 };
40 
41 #ifndef BLUEGIGA_BUFFER_SIZE
42 #define BLUEGIGA_BUFFER_SIZE 256 // buffer max value: 256
43 #elif BLUEGIGA_BUFFER_SIZE < 256
44 #warning "BLUEGIGA_BUFFER_SIZE may be smaller than possible message length, check subsystems/datalink/bluegiga.c:dev_check_free_space for more information"
45 #elif BLUEGIGA_BUFFER_SIZE > 256
46 #error "BLUEGIGA_BUFFER_SIZE not made for sizes larger than 256, check subsystems/datalink/bluegiga.c for more information"
47 #endif
48 
49 #define BLUEGIGA_SPI_BUF_SIZE 20
50 
52  /* Receive buffer */
56  /* Transmit buffer */
60  /* transmit and receive buffers */
64  struct link_device device;
65 
66  /* some administrative variables */
70 
71 };
72 
73 // DEVICE passed to all DOWNLINK_SEND functions
74 extern struct bluegiga_periph bluegiga_p;
75 extern signed char bluegiga_rssi[]; // values initialized with 127
76 
78 void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len);
79 
80 void bluegiga_init(struct bluegiga_periph *p);
81 void bluegiga_scan(struct bluegiga_periph *p);
82 void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len);
83 
84 #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:61
struct link_device device
Generic device interface.
Definition: bluegiga.h:64
#define BLUEGIGA_BUFFER_SIZE
Definition: bluegiga.h:42
uint8_t work_rx[BLUEGIGA_SPI_BUF_SIZE]
Definition: bluegiga.h:62
void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len)
Definition: bluegiga.c:122
The com is sending.
Definition: bluegiga.h:37
BlueGigaStatus
Definition: bluegiga.h:34
uint8_t connected
Definition: bluegiga.h:69
uint8_t rx_buf[BLUEGIGA_BUFFER_SIZE]
Definition: bluegiga.h:53
uint8_t tx_extract_idx
Definition: bluegiga.h:59
void bluegiga_scan(struct bluegiga_periph *p)
The com is switched from data link to rssi scanning.
Definition: bluegiga.h:38
uint8_t tx_insert_idx
Definition: bluegiga.h:58
uint32_t bytes_recvd_since_last
Definition: bluegiga.h:67
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:57
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:55
unsigned char uint8_t
Definition: types.h:14
The com isn't initialized.
Definition: bluegiga.h:35
#define BLUEGIGA_SPI_BUF_SIZE
Definition: bluegiga.h:49
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:36
uint8_t rx_insert_idx
Definition: bluegiga.h:54
uint8_t end_of_msg
Definition: bluegiga.h:68