Paparazzi UAS
v5.8.2_stable-0-g6260b7c
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 <string.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 |
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, uint8_t len) |
static void | dev_put_byte (struct bluegiga_periph *p, uint8_t byte) |
static void | dev_send_message (struct bluegiga_periph *p) |
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_t | bluegiga_ch_available (struct bluegiga_periph *p) |
void | bluegiga_increment_buf (uint8_t *buf_idx, uint8_t len) |
void | bluegiga_init (struct bluegiga_periph *p) |
void | bluegiga_scan (struct bluegiga_periph *p) |
void | bluegiga_request_all_rssi (struct bluegiga_periph *p) |
Variables | |
enum BlueGigaStatus | coms_status |
struct bluegiga_periph | bluegiga_p |
struct spi_transaction | bluegiga_spi |
signed char | bluegiga_rssi [256] |
unsigned char | telemetry_copy [20] |
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 42 of file bluegiga.c.
Referenced by bluegiga_init(), bluegiga_receive(), bluegiga_request_all_rssi(), and bluegiga_scan().
#define BLUEGIGA_DRDY_GPIO_PIN SUPERBITRF_DRDY_PIN |
Definition at line 46 of file bluegiga.c.
Referenced by bluegiga_init(), bluegiga_receive(), bluegiga_request_all_rssi(), and bluegiga_scan().
bool_t bluegiga_ch_available | ( | struct bluegiga_periph * | p | ) |
Definition at line 97 of file bluegiga.c.
References bluegiga_periph::rx_extract_idx, and bluegiga_periph::rx_insert_idx.
Referenced by bluegiga_read_buffer(), and dev_char_available().
Definition at line 103 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE.
Referenced by bluegiga_load_tx(), bluegiga_read_buffer(), bluegiga_receive(), bluegiga_transmit(), and dev_get_byte().
void bluegiga_init | ( | struct bluegiga_periph * | p | ) |
Definition at line 126 of file bluegiga.c.
References spi_transaction::after_cb, spi_transaction::bitorder, BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, bluegiga_rssi, bluegiga_spi, BLUEGIGA_UNINIT, bluegiga_periph::bytes_recvd_since_last, spi_transaction::cdiv, link_device::char_available, link_device::check_free_space, coms_status, spi_transaction::cpha, spi_transaction::cpol, DefaultPeriodic, dev_char_available(), dev_check_free_space(), dev_get_byte(), dev_put_byte(), dev_send_message(), bluegiga_periph::device, spi_transaction::dss, bluegiga_periph::end_of_msg, link_device::get_byte, gpio_set(), gpio_setup_output(), spi_transaction::input_buf, spi_transaction::input_length, LED_INIT, spi_transaction::output_buf, spi_transaction::output_length, link_device::periph, link_device::put_byte, register_periodic_telemetry(), bluegiga_periph::rx_extract_idx, bluegiga_periph::rx_insert_idx, spi_transaction::select, link_device::send_message, spi_transaction::slave_idx, spi_slave_register(), SPICphaEdge2, SPICpolIdleHigh, SPIDiv64, 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 downlink_init().
void bluegiga_load_tx | ( | struct bluegiga_periph * | p | ) |
Definition at line 197 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE, BLUEGIGA_IDLE, bluegiga_increment_buf(), BLUEGIGA_SENDING, bluegiga_spi, coms_status, bluegiga_periph::end_of_msg, spi_transaction::output_length, 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 229 of file bluegiga.c.
References BLUEGIGA_BROADCASTING, BLUEGIGA_BUFFER_SIZE, BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, BLUEGIGA_IDLE, bluegiga_increment_buf(), bluegiga_load_tx(), bluegiga_p, bluegiga_rssi, BLUEGIGA_SENDING, bluegiga_spi, BLUEGIGA_UNINIT, bluegiga_periph::bytes_recvd_since_last, coms_status, gpio_set(), spi_transaction::input_buf, spi_transaction::input_length, LED_OFF, spi_transaction::output_buf, spi_transaction::output_length, bluegiga_periph::rx_buf, bluegiga_periph::rx_insert_idx, spi_slave_register(), SPITransSuccess, spi_transaction::status, and telemetry_copy.
Referenced by trans_cb().
void bluegiga_request_all_rssi | ( | struct bluegiga_periph * | p | ) |
Definition at line 322 of file bluegiga.c.
References BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, BLUEGIGA_SENDING, coms_status, gpio_clear(), and bluegiga_periph::work_tx.
void bluegiga_scan | ( | struct bluegiga_periph * | p | ) |
Definition at line 309 of file bluegiga.c.
References BLUEGIGA_DRDY_GPIO, BLUEGIGA_DRDY_GPIO_PIN, BLUEGIGA_SENDING, coms_status, gpio_clear(), and bluegiga_periph::work_tx.
void bluegiga_transmit | ( | struct bluegiga_periph * | p, |
uint8_t | data | ||
) |
Definition at line 188 of file bluegiga.c.
References bluegiga_increment_buf(), BLUEGIGA_UNINIT, coms_status, dev_check_free_space(), bluegiga_periph::tx_buf, and bluegiga_periph::tx_insert_idx.
Referenced by dev_put_byte().
|
static |
Definition at line 79 of file bluegiga.c.
References bluegiga_ch_available().
Referenced by bluegiga_init().
|
static |
Definition at line 61 of file bluegiga.c.
References BLUEGIGA_BUFFER_SIZE, FALSE, TRUE, bluegiga_periph::tx_extract_idx, and bluegiga_periph::tx_insert_idx.
Referenced by bluegiga_init(), and bluegiga_transmit().
|
static |
Definition at line 83 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 71 of file bluegiga.c.
References bluegiga_transmit().
Referenced by bluegiga_init().
|
static |
Definition at line 75 of file bluegiga.c.
References bluegiga_periph::end_of_msg, and bluegiga_periph::tx_insert_idx.
Referenced by bluegiga_init().
|
static |
Definition at line 91 of file bluegiga.c.
References bluegiga_receive().
Referenced by bluegiga_init().
struct bluegiga_periph bluegiga_p |
Definition at line 50 of file bluegiga.c.
Referenced by bluegiga_receive(), and downlink_init().
signed char bluegiga_rssi[256] |
Definition at line 53 of file bluegiga.c.
Referenced by bluegiga_init(), and bluegiga_receive().
struct spi_transaction bluegiga_spi |
Definition at line 51 of file bluegiga.c.
Referenced by bluegiga_init(), bluegiga_load_tx(), and bluegiga_receive().
enum BlueGigaStatus coms_status |
Definition at line 49 of file bluegiga.c.
Referenced by bluegiga_init(), bluegiga_load_tx(), bluegiga_receive(), bluegiga_request_all_rssi(), bluegiga_scan(), and bluegiga_transmit().
unsigned char telemetry_copy[20] |
Definition at line 54 of file bluegiga.c.
Referenced by bluegiga_receive().