Paparazzi UAS  v5.2.2_stable-0-gd6b9f29
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
superbitrf.c File Reference
#include "subsystems/datalink/superbitrf.h"
#include <string.h>
#include "paparazzi.h"
#include "led.h"
#include "mcu_periph/spi.h"
#include "mcu_periph/sys_time.h"
#include "mcu_periph/gpio.h"
#include "subsystems/settings.h"
+ Include dependency graph for superbitrf.c:

Go to the source code of this file.

Macros

#define SUPERBITRF_SPI_DEV   spi1
 
#define SUPERBITRF_RST_PORT   GPIOC
 
#define SUPERBITRF_RST_PIN   GPIO12
 
#define SUPERBITRF_DRDY_PORT   GPIOB
 
#define SUPERBITRF_DRDY_PIN   GPIO1
 
#define SUPERBITRF_FORCE_DSM2   TRUE
 

Functions

 PRINT_CONFIG_VAR (SUPERBITRF_SPI_DEV)
 
 PRINT_CONFIG_VAR (SUPERBITRF_RST_PORT)
 
 PRINT_CONFIG_VAR (SUPERBITRF_RST_PIN)
 
 PRINT_CONFIG_VAR (SUPERBITRF_DRDY_PORT)
 
 PRINT_CONFIG_VAR (SUPERBITRF_DRDY_PIN)
 
 PRINT_CONFIG_VAR (SUPERBITRF_FORCE_DSM2)
 
static void superbitrf_radio_to_channels (uint8_t *data, uint8_t nb_channels, bool_t is_11bit, int16_t *channels)
 Parse a radio channel packet. More...
 
static void superbitrf_receive_packet_cb (bool_t error, uint8_t status, uint8_t packet[])
 When we receive a packet this callback is called. More...
 
static void superbitrf_send_packet_cb (bool_t error)
 
static void superbitrf_gen_dsmx_channels (void)
 Generate the channels. More...
 
void superbitrf_init (void)
 Initialize the superbitrf. More...
 
void superbitrf_set_mfg_id (uint32_t id)
 
void superbitrf_set_protocol (uint8_t protocol)
 
void superbitrf_event (void)
 The superbitrf on event call. More...
 

Variables

struct SuperbitRF superbitrf
 
static const uint8_t cyrf_stratup_config [][2]
 
static const uint8_t cyrf_bind_config [][2]
 
static const uint8_t cyrf_transfer_config [][2]
 
const uint8_t cyrf_abort_receive [][2]
 
const uint8_t cyrf_start_receive [][2]
 
static const uint8_t pn_codes [5][9][8]
 
static const uint8_t pn_bind [] = { 0x98, 0x88, 0x1B, 0xE4, 0x30, 0x79, 0x03, 0x84 }
 

Macro Definition Documentation

#define SUPERBITRF_DRDY_PIN   GPIO1

Definition at line 59 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_init().

#define SUPERBITRF_DRDY_PORT   GPIOB

Definition at line 55 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_init().

#define SUPERBITRF_FORCE_DSM2   TRUE

Definition at line 65 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_receive_packet_cb().

#define SUPERBITRF_RST_PIN   GPIO12

Definition at line 49 of file superbitrf.c.

Referenced by superbitrf_init().

#define SUPERBITRF_RST_PORT   GPIOC

Definition at line 45 of file superbitrf.c.

Referenced by superbitrf_init().

#define SUPERBITRF_SPI_DEV   spi1

Definition at line 39 of file superbitrf.c.

Referenced by superbitrf_init().

Function Documentation

PRINT_CONFIG_VAR ( SUPERBITRF_SPI_DEV  )

Referenced by electrical_init(), and superbitrf_event().

+ Here is the caller graph for this function:

PRINT_CONFIG_VAR ( SUPERBITRF_RST_PORT  )
PRINT_CONFIG_VAR ( SUPERBITRF_RST_PIN  )
PRINT_CONFIG_VAR ( SUPERBITRF_DRDY_PORT  )
PRINT_CONFIG_VAR ( SUPERBITRF_DRDY_PIN  )
PRINT_CONFIG_VAR ( SUPERBITRF_FORCE_DSM2  )
void superbitrf_event ( void  )

The superbitrf on event call.

Definition at line 254 of file superbitrf.c.

References SuperbitRF::bind_mfg_id, SuperbitRF::bind_mfg_id32, SuperbitRF::channel, SuperbitRF::channel_idx, SuperbitRF::channels, SuperbitRF::crc_seed, SuperbitRF::cyrf6936, CYRF6936_IDLE, cyrf6936_multi_write(), cyrf6936_read_rx_irq_status_packet(), cyrf6936_send(), cyrf6936_write(), cyrf6936_write_chan_sop_data_crc(), cyrf_abort_receive, cyrf_bind_config, CYRF_CHANNEL, CYRF_RXC_IRQ, CYRF_RXE_IRQ, cyrf_start_receive, cyrf_stratup_config, cyrf_transfer_config, CYRF_TXC_IRQ, CYRF_TXE_IRQ, SuperbitRF::data_col, FALSE, get_sys_time_usec(), gpio_get(), Cyrf6936::has_irq, SuperbitRF::irq_count, IS_DSM2, IS_DSMX, LED_ON, LED_TOGGLE, SuperbitRF::num_channels, SuperbitRF::packet_loss, SuperbitRF::packet_loss_bit, pn_bind, pn_codes, PRINT_CONFIG_VAR(), SuperbitRF::protocol, SuperbitRF::resync_count, Cyrf6936::rx_irq_status, Cyrf6936::rx_packet, SuperbitRF::rx_packet_count, Cyrf6936::rx_status, SuperbitRF::sop_col, SPEKTRUM_BIND_PIN, SPEKTRUM_BIND_PIN_PORT, SuperbitRF::state, Cyrf6936::status, SuperbitRF::status, superbitrf, SUPERBITRF_BIND_RECV_TIME, SUPERBITRF_BINDING, SUPERBITRF_DATARECV_TIME, SUPERBITRF_DATARECVB_TIME, SUPERBITRF_DRDY_PIN, SUPERBITRF_DRDY_PORT, SUPERBITRF_FORCE_DSM2, superbitrf_gen_dsmx_channels(), SUPERBITRF_INIT_BINDING, SUPERBITRF_INIT_TRANSFER, superbitrf_receive_packet_cb(), SUPERBITRF_RECV_SHORT_TIME, SUPERBITRF_RECV_TIME, superbitrf_send_packet_cb(), superbitrf_set_mfg_id(), superbitrf_set_protocol(), SUPERBITRF_SYNC_RECV_TIME, SUPERBITRF_SYNCING_A, SUPERBITRF_SYNCING_B, SUPERBITRF_TRANSFER, SUPERBITRF_UNINIT, SuperbitRF::timeouts, SuperbitRF::timer, SuperbitRF::timer_overflow, SuperbitRF::transfer_timeouts, TRUE, SuperbitRF::tx_buffer, SuperbitRF::tx_extract_idx, SuperbitRF::tx_insert_idx, Cyrf6936::tx_irq_status, and SuperbitRF::tx_packet_count.

+ Here is the call graph for this function:

static void superbitrf_gen_dsmx_channels ( void  )
inlinestatic

Generate the channels.

Definition at line 1014 of file superbitrf.c.

References SuperbitRF::bind_mfg_id, SuperbitRF::channels, and superbitrf.

Referenced by superbitrf_event().

+ Here is the caller graph for this function:

static void superbitrf_radio_to_channels ( uint8_t data,
uint8_t  nb_channels,
bool_t  is_11bit,
int16_t channels 
)
inlinestatic

Parse a radio channel packet.

Definition at line 986 of file superbitrf.c.

References MAX_PPRZ, and val.

Referenced by superbitrf_receive_packet_cb().

+ Here is the caller graph for this function:

static void superbitrf_send_packet_cb ( bool_t  error)
inlinestatic

Definition at line 958 of file superbitrf.c.

References SuperbitRF::state, SuperbitRF::status, superbitrf, SUPERBITRF_SYNCING_A, SUPERBITRF_SYNCING_B, and SUPERBITRF_TRANSFER.

Referenced by superbitrf_event().

+ Here is the caller graph for this function:

void superbitrf_set_mfg_id ( uint32_t  id)
void superbitrf_set_protocol ( uint8_t  protocol)

Definition at line 246 of file superbitrf.c.

References SuperbitRF::protocol, SuperbitRF::resolution, and superbitrf.

Variable Documentation

const uint8_t cyrf_abort_receive[][2]
Initial value:

Definition at line 108 of file superbitrf.c.

Referenced by superbitrf_event().

const uint8_t cyrf_bind_config[][2]
static
const uint8_t cyrf_start_receive[][2]
Initial value:
= {
}
#define CYRF_RXC_IRQEN
#define CYRF_RX_GO
#define CYRF_RXE_IRQEN
#define CYRF_RXOW_IRQ

Definition at line 113 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_receive_packet_cb().

const uint8_t cyrf_stratup_config[][2]
static
const uint8_t cyrf_transfer_config[][2]
static
Initial value:

Definition at line 101 of file superbitrf.c.

Referenced by superbitrf_event().

const uint8_t pn_bind[] = { 0x98, 0x88, 0x1B, 0xE4, 0x30, 0x79, 0x03, 0x84 }
static

Definition at line 176 of file superbitrf.c.

Referenced by superbitrf_event().

const uint8_t pn_codes[5][9][8]
static

Definition at line 119 of file superbitrf.c.

Referenced by superbitrf_event().

struct SuperbitRF superbitrf

Definition at line 70 of file superbitrf.c.