Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
superbitrf.c File Reference
#include "modules/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 "modules/core/settings.h"
#include "modules/datalink/telemetry.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
#define SUPERBITRF_UPDATE_DL   TRUE

Functions

static void superbitrf_radio_to_channels (uint8_t *data, uint8_t nb_channels, bool is_11bit, int16_t *channels)
 Parse a radio channel packet.
static void superbitrf_receive_packet_cb (bool error, uint8_t status, uint8_t packet[])
 When we receive a packet this callback is called.
static void superbitrf_send_packet_cb (bool error)
static void superbitrf_gen_dsmx_channels (void)
 Generate the channels.
static void send_superbit (struct transport_tx *trans, struct link_device *dev)
static int superbitrf_check_free_space (struct SuperbitRF *p, long *fd, uint16_t len)
static void superbitrf_transmit (struct SuperbitRF *p, long fd, uint8_t byte)
static void superbitrf_transmit_buffer (struct SuperbitRF *p, long fd, uint8_t *data, uint16_t len)
static void superbitrf_send (struct SuperbitRF *p, long fd)
static int null_function (struct SuperbitRF *p)
static uint8_t null_byte_function (struct SuperbitRF *p)
void superbitrf_init (void)
 Initialize the superbitrf.
void superbitrf_dl_init (void)
 Initialize datalink part.
void superbitrf_dl_event (void)
 The superbitrf datalink event call.
void superbitrf_set_mfg_id (uint32_t id)
void superbitrf_set_protocol (uint8_t protocol)
void superbitrf_event (void)
 The superbitrf on event call.

Variables

struct SuperbitRF superbitrf
struct pprz_transport pprz_srf_tp
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

◆ SUPERBITRF_DRDY_PIN

#define SUPERBITRF_DRDY_PIN   GPIO1

Definition at line 59 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_init().

◆ SUPERBITRF_DRDY_PORT

#define SUPERBITRF_DRDY_PORT   GPIOB

Definition at line 55 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_init().

◆ SUPERBITRF_FORCE_DSM2

#define SUPERBITRF_FORCE_DSM2   TRUE

Definition at line 65 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_receive_packet_cb().

◆ SUPERBITRF_RST_PIN

#define SUPERBITRF_RST_PIN   GPIO12

Definition at line 49 of file superbitrf.c.

Referenced by superbitrf_init().

◆ SUPERBITRF_RST_PORT

#define SUPERBITRF_RST_PORT   GPIOC

Definition at line 45 of file superbitrf.c.

Referenced by superbitrf_init().

◆ SUPERBITRF_SPI_DEV

#define SUPERBITRF_SPI_DEV   spi1

Definition at line 39 of file superbitrf.c.

Referenced by superbitrf_init().

◆ SUPERBITRF_UPDATE_DL

#define SUPERBITRF_UPDATE_DL   TRUE

Definition at line 70 of file superbitrf.c.

Referenced by superbitrf_dl_event().

Function Documentation

◆ null_byte_function()

uint8_t null_byte_function ( struct SuperbitRF * p)
static

Definition at line 237 of file superbitrf.c.

References p.

Referenced by chibios_sdlog_init(), and superbitrf_init().

Here is the caller graph for this function:

◆ null_function()

int null_function ( struct SuperbitRF * p)
static

Definition at line 236 of file superbitrf.c.

References p.

Referenced by chibios_sdlog_init(), gps_ubx_i2c_init(), and superbitrf_init().

Here is the caller graph for this function:

◆ send_superbit()

void send_superbit ( struct transport_tx * trans,
struct link_device * dev )
static

Definition at line 188 of file superbitrf.c.

References dev, status, and superbitrf.

Referenced by superbitrf_init().

Here is the caller graph for this function:

◆ superbitrf_check_free_space()

int superbitrf_check_free_space ( struct SuperbitRF * p,
long * fd,
uint16_t len )
static

Definition at line 211 of file superbitrf.c.

References fd, p, and SUPERBITRF_TX_BUFFER_SIZE.

Referenced by superbitrf_init().

Here is the caller graph for this function:

◆ superbitrf_dl_event()

void superbitrf_dl_event ( void )

The superbitrf datalink event call.

Definition at line 294 of file superbitrf.c.

References datalink_get_buffer(), dl_msg_available, DlCheckAndParse(), DOWNLINK_DEVICE, pprz_srf_tp, and SUPERBITRF_UPDATE_DL.

Here is the call graph for this function:

◆ superbitrf_dl_init()

void superbitrf_dl_init ( void )

Initialize datalink part.

Definition at line 285 of file superbitrf.c.

References pprz_srf_tp.

◆ superbitrf_event()

◆ superbitrf_gen_dsmx_channels()

void superbitrf_gen_dsmx_channels ( void )
inlinestatic

Generate the channels.

Definition at line 1118 of file superbitrf.c.

References idx, and superbitrf.

Referenced by superbitrf_event().

Here is the caller graph for this function:

◆ superbitrf_init()

◆ superbitrf_radio_to_channels()

void superbitrf_radio_to_channels ( uint8_t * data,
uint8_t nb_channels,
bool is_11bit,
int16_t * channels )
inlinestatic

Parse a radio channel packet.

Definition at line 1089 of file superbitrf.c.

References MAX_PPRZ, and val.

Referenced by superbitrf_receive_packet_cb().

Here is the caller graph for this function:

◆ superbitrf_receive_packet_cb()

void superbitrf_receive_packet_cb ( bool error,
uint8_t status,
uint8_t packet[] )
inlinestatic

◆ superbitrf_send()

void superbitrf_send ( struct SuperbitRF * p,
long fd )
static

Definition at line 234 of file superbitrf.c.

References fd, and p.

Referenced by superbitrf_init().

Here is the caller graph for this function:

◆ superbitrf_send_packet_cb()

void superbitrf_send_packet_cb ( bool error)
inlinestatic

Definition at line 1058 of file superbitrf.c.

References superbitrf, SUPERBITRF_SYNCING_A, SUPERBITRF_SYNCING_B, and SUPERBITRF_TRANSFER.

Referenced by superbitrf_event().

Here is the caller graph for this function:

◆ superbitrf_set_mfg_id()

void superbitrf_set_mfg_id ( uint32_t id)

Definition at line 299 of file superbitrf.c.

References superbitrf.

◆ superbitrf_set_protocol()

void superbitrf_set_protocol ( uint8_t protocol)

Definition at line 313 of file superbitrf.c.

References superbitrf.

◆ superbitrf_transmit()

void superbitrf_transmit ( struct SuperbitRF * p,
long fd,
uint8_t byte )
static

Definition at line 220 of file superbitrf.c.

References fd, p, and SUPERBITRF_TX_BUFFER_SIZE.

Referenced by superbitrf_init(), and superbitrf_transmit_buffer().

Here is the caller graph for this function:

◆ superbitrf_transmit_buffer()

void superbitrf_transmit_buffer ( struct SuperbitRF * p,
long fd,
uint8_t * data,
uint16_t len )
static

Definition at line 226 of file superbitrf.c.

References fd, p, and superbitrf_transmit().

Referenced by superbitrf_init().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ cyrf_abort_receive

const uint8_t cyrf_abort_receive[][2]
Initial value:
= {
{CYRF_RX_ABORT, 0x00}
}
@ CYRF_MODE_SYNTH_RX
@ CYRF_XACT_CFG
@ CYRF_RX_ABORT
#define CYRF_FRC_END

Definition at line 115 of file superbitrf.c.

Referenced by superbitrf_event().

◆ cyrf_bind_config

const uint8_t cyrf_bind_config[][2]
static
Initial value:
= {
{CYRF_EOP_CTRL, 0x02},
}
@ CYRF_DATA_MODE_SDR
#define CYRF_SOP_LEN
#define CYRF_DIS_RXCRC
@ CYRF_PA_4
#define CYRF_FRC_RXDR
@ CYRF_EOP_CTRL
@ CYRF_RX_OVERRIDE
@ CYRF_FRAMING_CFG
@ CYRF_TX_CFG
@ CYRF_TX_OVERRIDE
#define CYRF_DATA_CODE_LENGTH
#define CYRF_DIS_TXCRC

Definition at line 100 of file superbitrf.c.

Referenced by superbitrf_event().

◆ cyrf_start_receive

const uint8_t cyrf_start_receive[][2]
Initial value:
= {
}
#define CYRF_RXE_IRQEN
#define CYRF_RX_GO
@ CYRF_RX_CTRL
@ CYRF_RX_IRQ_STATUS
#define CYRF_RXOW_IRQ
#define CYRF_RXC_IRQEN

Definition at line 120 of file superbitrf.c.

Referenced by superbitrf_event(), and superbitrf_receive_packet_cb().

◆ cyrf_stratup_config

const uint8_t cyrf_stratup_config[][2]
static
Initial value:
= {
}
#define CYRF_RXF
#define CYRF_RST
@ CYRF_TX_OFFSET_LSB
@ CYRF_AUTO_CAL_TIME
@ CYRF_DATA64_THOLD
@ CYRF_CLK_EN
@ CYRF_MODE_OVERRIDE
@ CYRF_TX_OFFSET_MSB
@ CYRF_RX_CFG
@ CYRF_AUTO_CAL_OFFSET
#define CYRF_FAST_TURN_EN
#define CYRF_LNA

Definition at line 86 of file superbitrf.c.

Referenced by superbitrf_event().

◆ cyrf_transfer_config

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

Definition at line 108 of file superbitrf.c.

Referenced by superbitrf_event().

◆ pn_bind

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

Definition at line 183 of file superbitrf.c.

Referenced by superbitrf_event().

◆ pn_codes

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

Definition at line 126 of file superbitrf.c.

Referenced by superbitrf_event().

◆ pprz_srf_tp

struct pprz_transport pprz_srf_tp

Definition at line 77 of file superbitrf.c.

Referenced by superbitrf_dl_event(), and superbitrf_dl_init().

◆ superbitrf

struct SuperbitRF superbitrf

Definition at line 74 of file superbitrf.c.