Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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 */
bluegiga_periph::tx_buf
uint8_t tx_buf[BLUEGIGA_BUFFER_SIZE]
Definition: bluegiga.h:58
bluegiga_periph
Definition: bluegiga.h:52
bluegiga_periph::rx_extract_idx
uint8_t rx_extract_idx
Definition: bluegiga.h:56
bluegiga_scan
void bluegiga_scan(struct bluegiga_periph *p)
bluegiga_periph::tx_insert_idx
uint8_t tx_insert_idx
Definition: bluegiga.h:59
BLUEGIGA_BUFFER_SIZE
#define BLUEGIGA_BUFFER_SIZE
Definition: bluegiga.h:43
bluegiga_rssi
signed char bluegiga_rssi[]
BLUEGIGA_SENDING
@ BLUEGIGA_SENDING
The com is sending.
Definition: bluegiga.h:38
uint32_t
unsigned long uint32_t
Definition: types.h:18
bluegiga_periph::work_tx
uint8_t work_tx[BLUEGIGA_SPI_BUF_SIZE]
Definition: bluegiga.h:62
BLUEGIGA_SENDING_BROADCAST
@ BLUEGIGA_SENDING_BROADCAST
The com is switched from data link to rssi scanning.
Definition: bluegiga.h:39
BLUEGIGA_SPI_BUF_SIZE
#define BLUEGIGA_SPI_BUF_SIZE
Definition: bluegiga.h:50
msg
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
Definition: high_speed_logger_direct_memory.c:134
bluegiga_broadcast_msg
void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len)
Definition: bluegiga.c:343
bluegiga_ch_available
bool bluegiga_ch_available(struct bluegiga_periph *p)
Definition: bluegiga.c:116
bluegiga_periph::device
struct link_device device
Generic device interface.
Definition: bluegiga.h:65
bluegiga_periph::end_of_msg
uint8_t end_of_msg
Definition: bluegiga.h:69
uint8_t
unsigned char uint8_t
Definition: types.h:14
bluegiga_periph::bytes_recvd_since_last
uint32_t bytes_recvd_since_last
Definition: bluegiga.h:68
bluegiga_increment_buf
void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len)
Definition: bluegiga.c:122
BLUEGIGA_UNINIT
@ BLUEGIGA_UNINIT
The com isn't initialized.
Definition: bluegiga.h:36
bluegiga_periph::work_rx
uint8_t work_rx[BLUEGIGA_SPI_BUF_SIZE]
Definition: bluegiga.h:63
bluegiga_periph::rx_buf
uint8_t rx_buf[BLUEGIGA_BUFFER_SIZE]
Definition: bluegiga.h:54
BLUEGIGA_IDLE
@ BLUEGIGA_IDLE
The com is in idle.
Definition: bluegiga.h:37
bluegiga_periph::tx_extract_idx
uint8_t tx_extract_idx
Definition: bluegiga.h:60
BlueGigaStatus
BlueGigaStatus
Definition: bluegiga.h:35
bluegiga_periph::rx_insert_idx
uint8_t rx_insert_idx
Definition: bluegiga.h:55
bluegiga_p
struct bluegiga_periph bluegiga_p
Definition: bluegiga.c:61
p
static float p[2][2]
Definition: ins_alt_float.c:268
bluegiga_init
void bluegiga_init(struct bluegiga_periph *p)
Definition: bluegiga.c:148
bluegiga_periph::connected
uint8_t connected
Definition: bluegiga.h:70