Paparazzi UAS
v5.14.0_stable-0-g3f680d1
Paparazzi is a free software Unmanned Aircraft System.
|
Datalink implementation for the BlueGiga Bluetooth radio chip trough SPI. More...
#include "mcu_periph/sys_time.h"
#include "subsystems/datalink/bluegiga.h"
#include "mcu_periph/gpio.h"
#include "mcu_periph/spi.h"
#include "subsystems/abi.h"
#include <string.h>
#include "subsystems/datalink/telemetry.h"
Go to the source code of this file.
Macros | |
#define | BLUEGIGA_DRDY_GPIO SUPERBITRF_DRDY_PORT |
#define | BLUEGIGA_DRDY_GPIO_PIN SUPERBITRF_DRDY_PIN |
#define | TxStrengthOfSender(x) (x[1]) |
#define | RssiOfSender(x) (x[2]) |
#define | Pprz_StxOfMsg(x) (x[3]) |
#define | SenderIdOfBGMsg(x) (x[5]) |
Functions | |
void | bluegiga_load_tx (struct bluegiga_periph *p) |
void | bluegiga_transmit (struct bluegiga_periph *p, uint8_t data) |
void | bluegiga_receive (struct spi_transaction *trans) |
static int | dev_check_free_space (struct bluegiga_periph *p, long *fd, uint16_t len) |
static void | dev_put_buffer (struct bluegiga_periph *p, long fd, uint8_t *data, uint16_t len) |
static void | dev_put_byte (struct bluegiga_periph *p, long fd, uint8_t byte) |
static void | dev_send_message (struct bluegiga_periph *p, long fd) |
static int | dev_char_available (struct bluegiga_periph *p) |
static uint8_t | dev_get_byte (struct bluegiga_periph *p) |
static void | trans_cb (struct spi_transaction *trans) |
bool | bluegiga_ch_available (struct bluegiga_periph *p) |
void | bluegiga_increment_buf (uint8_t *buf_idx, uint8_t len) |
static void | send_bluegiga (struct transport_tx *trans, struct link_device *dev) |
void | bluegiga_init (struct bluegiga_periph *p) |
void | bluegiga_broadcast_msg (struct bluegiga_periph *p, char *msg, uint8_t msg_len) |
Variables | |
enum BlueGigaStatus | coms_status |
struct bluegiga_periph | bluegiga_p |
struct spi_transaction | bluegiga_spi |
uint8_t | broadcast_msg [20] |
uint32_t | a2a_msgs = 0 |
uint32_t | last_ts = 0 |
Datalink implementation for the BlueGiga Bluetooth radio chip trough SPI.
Definition in file bluegiga.c.
#define BLUEGIGA_DRDY_GPIO SUPERBITRF_DRDY_PORT |
Definition at line 48 of file bluegiga.c.
Referenced by bluegiga_broadcast_msg(), bluegiga_init(), and bluegiga_receive().
#define BLUEGIGA_DRDY_GPIO_PIN SUPERBITRF_DRDY_PIN |
Definition at line 52 of file bluegiga.c.
Referenced by bluegiga_broadcast_msg(), bluegiga_init(), and bluegiga_receive().
#define Pprz_StxOfMsg | ( | x | ) | (x[3]) |
Definition at line 57 of file bluegiga.c.
Referenced by bluegiga_receive().
#define RssiOfSender | ( | x | ) | (x[2]) |
Definition at line 56 of file bluegiga.c.
Referenced by bluegiga_receive().
#define SenderIdOfBGMsg | ( | x | ) | (x[5]) |
Definition at line 58 of file bluegiga.c.
Referenced by bluegiga_receive().
#define TxStrengthOfSender | ( | x | ) | (x[1]) |
Definition at line 55 of file bluegiga.c.
Referenced by bluegiga_receive().
void bluegiga_broadcast_msg | ( | struct bluegiga_periph * | p, |
char * | msg, | ||
uint8_t | msg_len | ||
) |
Definition at line 343 of file bluegiga.c.
References BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, BLUEGIGA_SENDING, BLUEGIGA_SENDING_BROADCAST, broadcast_msg, coms_status, gpio_clear(), and bluegiga_periph::work_tx.
bool bluegiga_ch_available | ( | struct bluegiga_periph * | p | ) |
Definition at line 116 of file bluegiga.c.
References bluegiga_periph::rx_extract_idx, and bluegiga_periph::rx_insert_idx.
Referenced by dev_char_available().
Definition at line 122 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE.
Referenced by bluegiga_load_tx(), bluegiga_receive(), bluegiga_transmit(), and dev_get_byte().
void bluegiga_init | ( | struct bluegiga_periph * | p | ) |
Definition at line 148 of file bluegiga.c.
References spi_transaction::after_cb, spi_transaction::bitorder, BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, bluegiga_spi, BLUEGIGA_SPI_BUF_SIZE, BLUEGIGA_UNINIT, broadcast_msg, bluegiga_periph::bytes_recvd_since_last, spi_transaction::cdiv, coms_status, bluegiga_periph::connected, spi_transaction::cpha, spi_transaction::cpol, DefaultPeriodic, dev_char_available(), dev_check_free_space(), dev_get_byte(), dev_put_buffer(), dev_put_byte(), dev_send_message(), bluegiga_periph::device, spi_transaction::dss, bluegiga_periph::end_of_msg, gpio_set(), gpio_setup_output(), spi_transaction::input_buf, spi_transaction::input_length, LED_INIT, spi_transaction::output_buf, spi_transaction::output_length, register_periodic_telemetry(), bluegiga_periph::rx_extract_idx, bluegiga_periph::rx_insert_idx, spi_transaction::select, send_bluegiga(), spi_transaction::slave_idx, spi_slave_register(), SPICphaEdge2, SPICpolIdleHigh, SPIDiv256, SPIDss8bit, SPIMSBFirst, SPISelectUnselect, trans_cb(), bluegiga_periph::tx_extract_idx, bluegiga_periph::tx_insert_idx, bluegiga_periph::work_rx, and bluegiga_periph::work_tx.
Referenced by bluegiga_dl_init().
void bluegiga_load_tx | ( | struct bluegiga_periph * | p | ) |
Definition at line 217 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE, BLUEGIGA_IDLE, bluegiga_increment_buf(), BLUEGIGA_SENDING, BLUEGIGA_SPI_BUF_SIZE, coms_status, bluegiga_periph::end_of_msg, bluegiga_periph::tx_buf, bluegiga_periph::tx_extract_idx, and bluegiga_periph::work_tx.
Referenced by bluegiga_receive().
void bluegiga_receive | ( | struct spi_transaction * | trans | ) |
Definition at line 250 of file bluegiga.c.
References ac_id, BLUEGIGA_BUFFER_SIZE, BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, BLUEGIGA_IDLE, bluegiga_increment_buf(), bluegiga_load_tx(), bluegiga_p, BLUEGIGA_SENDING, BLUEGIGA_SENDING_BROADCAST, broadcast_msg, bluegiga_periph::bytes_recvd_since_last, coms_status, bluegiga_periph::connected, gpio_set(), spi_transaction::input_buf, spi_transaction::input_length, LED_TOGGLE, spi_transaction::output_buf, spi_transaction::output_length, Pprz_StxOfMsg, RSSI_BLUEGIGA_ID, RssiOfSender, bluegiga_periph::rx_buf, bluegiga_periph::rx_insert_idx, SenderIdOfBGMsg, spi_slave_register(), SPITransSuccess, spi_transaction::status, and TxStrengthOfSender.
Referenced by trans_cb().
void bluegiga_transmit | ( | struct bluegiga_periph * | p, |
uint8_t | data | ||
) |
Definition at line 207 of file bluegiga.c.
References bluegiga_increment_buf(), BLUEGIGA_UNINIT, coms_status, dev_check_free_space(), fd, bluegiga_periph::tx_buf, and bluegiga_periph::tx_insert_idx.
Referenced by dev_put_buffer(), and dev_put_byte().
|
static |
Definition at line 96 of file bluegiga.c.
References bluegiga_ch_available().
Referenced by bluegiga_init().
|
static |
Definition at line 71 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE, bluegiga_periph::tx_extract_idx, and bluegiga_periph::tx_insert_idx.
Referenced by bluegiga_init(), and bluegiga_transmit().
|
static |
Definition at line 102 of file bluegiga.c.
References bluegiga_increment_buf(), bluegiga_periph::rx_buf, and bluegiga_periph::rx_extract_idx.
Referenced by bluegiga_init().
|
static |
Definition at line 81 of file bluegiga.c.
References bluegiga_transmit().
Referenced by bluegiga_init().
|
static |
Definition at line 88 of file bluegiga.c.
References bluegiga_transmit().
Referenced by bluegiga_init().
|
static |
Definition at line 92 of file bluegiga.c.
References bluegiga_periph::end_of_msg, and bluegiga_periph::tx_insert_idx.
Referenced by bluegiga_init().
|
static |
Definition at line 132 of file bluegiga.c.
References bluegiga_p, bluegiga_periph::bytes_recvd_since_last, get_sys_time_msec(), and last_ts.
Referenced by bluegiga_init().
|
static |
Definition at line 110 of file bluegiga.c.
References bluegiga_receive().
Referenced by bluegiga_init().
uint32_t a2a_msgs = 0 |
Definition at line 127 of file bluegiga.c.
struct bluegiga_periph bluegiga_p |
Definition at line 61 of file bluegiga.c.
Referenced by bluegiga_dl_init(), bluegiga_receive(), and send_bluegiga().
struct spi_transaction bluegiga_spi |
Definition at line 62 of file bluegiga.c.
Referenced by bluegiga_init().
uint8_t broadcast_msg[20] |
Definition at line 64 of file bluegiga.c.
Referenced by bluegiga_broadcast_msg(), bluegiga_init(), and bluegiga_receive().
enum BlueGigaStatus coms_status |
Definition at line 60 of file bluegiga.c.
Referenced by bluegiga_broadcast_msg(), bluegiga_init(), bluegiga_load_tx(), bluegiga_receive(), and bluegiga_transmit().
uint32_t last_ts = 0 |
Definition at line 131 of file bluegiga.c.
Referenced by ins_alt_float_update_baro(), ins_alt_float_update_gps(), send_bluegiga(), stabilization_attitude_read_rc_setpoint_eulers(), and stabilization_attitude_read_rc_setpoint_eulers_f().