Paparazzi UAS v7.0_unstable
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 */
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 modules/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 modules/datalink/bluegiga.c for more information"
48#endif
49
50#define BLUEGIGA_SPI_BUF_SIZE 20
51
73
74// DEVICE passed to all DOWNLINK_SEND functions
75extern struct bluegiga_periph bluegiga_p;
76extern signed char bluegiga_rssi[]; // values initialized with 127
77
79void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len);
80
81void bluegiga_init(struct bluegiga_periph *p);
83void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len);
84
85#endif /* BLUEGIGA_DATA_LINK_H */
uint8_t tx_insert_idx
Definition bluegiga.h:59
BlueGigaStatus
Definition bluegiga.h:35
@ BLUEGIGA_SENDING_BROADCAST
The com is switched from data link to rssi scanning.
Definition bluegiga.h:39
@ BLUEGIGA_IDLE
The com is in idle.
Definition bluegiga.h:37
@ BLUEGIGA_UNINIT
The com isn't initialized.
Definition bluegiga.h:36
@ BLUEGIGA_SENDING
The com is sending.
Definition bluegiga.h:38
#define BLUEGIGA_SPI_BUF_SIZE
Definition bluegiga.h:50
uint8_t connected
Definition bluegiga.h:70
struct link_device device
Generic device interface.
Definition bluegiga.h:65
void bluegiga_broadcast_msg(struct bluegiga_periph *p, char *msg, uint8_t msg_len)
Definition bluegiga.c:343
uint8_t rx_buf[BLUEGIGA_BUFFER_SIZE]
Definition bluegiga.h:54
void bluegiga_scan(struct bluegiga_periph *p)
bool bluegiga_ch_available(struct bluegiga_periph *p)
Definition bluegiga.c:116
uint8_t work_tx[BLUEGIGA_SPI_BUF_SIZE]
Definition bluegiga.h:62
uint8_t tx_extract_idx
Definition bluegiga.h:60
signed char bluegiga_rssi[]
struct bluegiga_periph bluegiga_p
Definition bluegiga.c:61
uint8_t end_of_msg
Definition bluegiga.h:69
void bluegiga_init(struct bluegiga_periph *p)
Definition bluegiga.c:148
void bluegiga_increment_buf(uint8_t *buf_idx, uint8_t len)
Definition bluegiga.c:122
uint8_t rx_insert_idx
Definition bluegiga.h:55
uint8_t rx_extract_idx
Definition bluegiga.h:56
uint32_t bytes_recvd_since_last
Definition bluegiga.h:68
#define BLUEGIGA_BUFFER_SIZE
Definition bluegiga.h:43
uint8_t work_rx[BLUEGIGA_SPI_BUF_SIZE]
Definition bluegiga.h:63
uint8_t tx_buf[BLUEGIGA_BUFFER_SIZE]
Definition bluegiga.h:58
uint8_t msg[10]
Buffer used for general comunication over SPI (out buffer)
static float p[2][2]
uint16_t foo
Definition main_demo5.c:58
unsigned int uint32_t
Typedef defining 32 bit unsigned int type.
unsigned char uint8_t
Typedef defining 8 bit unsigned char type.