Paparazzi UAS  v5.17_devel-24-g2ae834f
Paparazzi is a free software Unmanned Aircraft System.
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
cc2500_frsky_x.c File Reference
#include "cc2500_compat.h"
#include "peripherals/cc2500.h"
#include "cc2500_settings.h"
#include "cc2500_rx_spi_common.h"
#include "cc2500_common.h"
#include "cc2500_frsky_common.h"
#include "cc2500_frsky_shared.h"
#include "cc2500_frsky_x.h"
#include "cc2500_smartport.h"
#include <string.h>
+ Include dependency graph for cc2500_frsky_x.c:

Go to the source code of this file.

Data Structures

struct  telemetrySequenceMarkerData_s
 
union  telemetrySequenceMarker_s
 
struct  telemetryData_s
 
struct  telemetryBuffer_s
 
struct  telemetryPayload_s
 

Macros

#define UNUSED(x)   (void)(x)
 
#define TELEMETRY_OUT_BUFFER_SIZE   64
 
#define TELEMETRY_SEQUENCE_LENGTH   4
 
#define A1_CONST_X   50
 
#define SEQUENCE_MARKER_REMOTE_PART   0xf0
 
#define TELEMETRY_DATA_SIZE   5
 
#define TELEMETRY_FRAME_SIZE   sizeof(telemetryData_t)
 

Typedefs

typedef struct
telemetrySequenceMarkerData_s 
telemetrySequenceMarkerData_t
 
typedef union
telemetrySequenceMarker_s 
telemetrySequenceMarker_t
 
typedef struct telemetryData_s telemetryData_t
 
typedef struct telemetryBuffer_s telemetryBuffer_t
 
typedef struct telemetryPayload_s telemetryPayload_t
 

Functions

static uint16_t calculateCrc (const uint8_t *data, uint8_t len)
 
static uint8_t appendSmartPortData (uint8_t *buf)
 
static void buildTelemetryFrame (uint8_t *packet)
 
static bool frSkyXCheckQueueEmpty (void)
 
static void frSkyXTelemetrySendByte (uint8_t c)
 
static void frSkyXTelemetryWriteFrame (const smartPortPayload_t *payload)
 
void frSkyXSetRcData (uint16_t *rcData, const uint8_t *packet)
 
bool isValidPacket (const uint8_t *packet)
 
rx_spi_received_e frSkyXHandlePacket (uint8_t *const packet, uint8_t *const protocolState)
 
rx_spi_received_e frSkyXProcessFrame (uint8_t *const packet)
 
void frSkyXInit (const rx_spi_protocol_e spiProtocol)
 

Variables

const uint16_t crcTable []
 
static telemetryData_t telemetryTxBuffer [TELEMETRY_SEQUENCE_LENGTH]
 
static telemetryBuffer_t telemetryRxBuffer [TELEMETRY_SEQUENCE_LENGTH]
 
static telemetrySequenceMarker_t responseToSend
 
static uint8_t frame [20]
 
static uint8_t telemetryOutWriter
 
static uint8_t telemetryOutBuffer [TELEMETRY_OUT_BUFFER_SIZE]
 
static bool telemetryEnabled = false
 
static uint8_t remoteToProcessId = 0
 
static uint8_t remoteToProcessIndex = 0
 
static uint8_t packetLength
 
static uint16_t telemetryDelayUs
 

Data Structure Documentation

struct telemetrySequenceMarkerData_s

Definition at line 116 of file cc2500_frsky_x.c.

Data Fields
unsigned int ackSequenceId: 2
unsigned int initRequest: 1
unsigned int initResponse: 1
unsigned int packetSequenceId: 2
unsigned int retransmissionRequested: 1
unsigned int unused: 1
union telemetrySequenceMarker_s

Definition at line 125 of file cc2500_frsky_x.c.

+ Collaboration diagram for telemetrySequenceMarker_s:
Data Fields
telemetrySequenceMarkerData_t data
uint8_t raw
struct telemetryData_s

Definition at line 134 of file cc2500_frsky_x.c.

Data Fields
uint8_t data[TELEMETRY_DATA_SIZE]
uint8_t dataLength
struct telemetryBuffer_s

Definition at line 139 of file cc2500_frsky_x.c.

+ Collaboration diagram for telemetryBuffer_s:
Data Fields
telemetryData_t data
uint8_t needsProcessing
struct telemetryPayload_s

Definition at line 146 of file cc2500_frsky_x.c.

+ Collaboration diagram for telemetryPayload_s:
Data Fields
uint8_t crc[2]
telemetryData_t data
uint8_t packetConst
uint8_t rssiA1
telemetrySequenceMarker_t sequence

Macro Definition Documentation

#define A1_CONST_X   50

Definition at line 114 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame().

#define SEQUENCE_MARKER_REMOTE_PART   0xf0

Definition at line 130 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame().

#define TELEMETRY_DATA_SIZE   5

Definition at line 132 of file cc2500_frsky_x.c.

Referenced by appendSmartPortData().

#define TELEMETRY_FRAME_SIZE   sizeof(telemetryData_t)

Definition at line 144 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame(), and frSkyXHandlePacket().

#define TELEMETRY_OUT_BUFFER_SIZE   64
#define TELEMETRY_SEQUENCE_LENGTH   4

Definition at line 112 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame(), frSkyXHandlePacket(), and frSkyXProcessFrame().

#define UNUSED (   x)    (void)(x)

Definition at line 12 of file cc2500_frsky_x.c.

Referenced by frSkyXProcessFrame().

Typedef Documentation

Function Documentation

static uint8_t appendSmartPortData ( uint8_t buf)
static

Definition at line 190 of file cc2500_frsky_x.c.

References TELEMETRY_DATA_SIZE, and TELEMETRY_OUT_BUFFER_SIZE.

Referenced by buildTelemetryFrame().

+ Here is the caller graph for this function:

static uint16_t calculateCrc ( const uint8_t data,
uint8_t  len 
)
static

Definition at line 180 of file cc2500_frsky_x.c.

References crc.

Referenced by buildTelemetryFrame(), and isValidPacket().

+ Here is the caller graph for this function:

static bool frSkyXCheckQueueEmpty ( void  )
static

Definition at line 271 of file cc2500_frsky_x.c.

Referenced by frSkyXProcessFrame().

+ Here is the caller graph for this function:

void frSkyXInit ( const rx_spi_protocol_e  spiProtocol)

Definition at line 582 of file cc2500_frsky_x.c.

References FEATURE_TELEMETRY, featureIsEnabled, frSkyXTelemetryWriteFrame(), initSmartPortTelemetryExternal(), RX_SPI_FRSKY_X, and RX_SPI_FRSKY_X_LBT.

Referenced by frSkySpiInit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

rx_spi_received_e frSkyXProcessFrame ( uint8_t *const  packet)

Definition at line 544 of file cc2500_frsky_x.c.

References telemetryBuffer_s::data, frSkyXCheckQueueEmpty(), millis, telemetryBuffer_s::needsProcessing, processSmartPortTelemetry(), remoteToProcessId, RX_SPI_RECEIVED_NONE, smartPortDataReceive(), TELEMETRY_SEQUENCE_LENGTH, and UNUSED.

Referenced by frSkySpiInit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void frSkyXSetRcData ( uint16_t rcData,
const uint8_t packet 
)

Definition at line 304 of file cc2500_frsky_x.c.

Referenced by frSkySpiInit().

+ Here is the caller graph for this function:

static void frSkyXTelemetrySendByte ( uint8_t  c)
static

Definition at line 277 of file cc2500_frsky_x.c.

References FSSP_DLE, FSSP_DLE_XOR, FSSP_START_STOP, TELEMETRY_OUT_BUFFER_SIZE, and telemetryOutWriter.

Referenced by frSkyXTelemetryWriteFrame().

+ Here is the caller graph for this function:

static void frSkyXTelemetryWriteFrame ( const smartPortPayload_t payload)
static

Definition at line 289 of file cc2500_frsky_x.c.

References frSkyXTelemetrySendByte(), FSSP_SENSOR_ID1, FSSP_START_STOP, TELEMETRY_OUT_BUFFER_SIZE, and telemetryOutWriter.

Referenced by frSkyXInit().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool isValidPacket ( const uint8_t packet)

Definition at line 327 of file cc2500_frsky_x.c.

References calculateCrc(), and rxCc2500SpiConfig().

Referenced by frSkyXHandlePacket().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

const uint16_t crcTable[]

Definition at line 75 of file cc2500_frsky_x.c.

uint8_t frame[20]
static

Definition at line 163 of file cc2500_frsky_x.c.

Referenced by get_object(), and texton_func().

uint8_t packetLength
static

Definition at line 177 of file cc2500_frsky_x.c.

uint8_t remoteToProcessId = 0
static

Definition at line 172 of file cc2500_frsky_x.c.

Referenced by frSkyXProcessFrame().

uint8_t remoteToProcessIndex = 0
static

Definition at line 173 of file cc2500_frsky_x.c.

telemetrySequenceMarker_t responseToSend
static

Definition at line 160 of file cc2500_frsky_x.c.

uint16_t telemetryDelayUs
static

Definition at line 178 of file cc2500_frsky_x.c.

bool telemetryEnabled = false
static

Definition at line 170 of file cc2500_frsky_x.c.

uint8_t telemetryOutBuffer[TELEMETRY_OUT_BUFFER_SIZE]
static

Definition at line 168 of file cc2500_frsky_x.c.

uint8_t telemetryOutWriter
static

Definition at line 166 of file cc2500_frsky_x.c.

Referenced by frSkyXTelemetrySendByte(), and frSkyXTelemetryWriteFrame().

telemetryBuffer_t telemetryRxBuffer[TELEMETRY_SEQUENCE_LENGTH]
static

Definition at line 158 of file cc2500_frsky_x.c.

telemetryData_t telemetryTxBuffer[TELEMETRY_SEQUENCE_LENGTH]
static

Definition at line 155 of file cc2500_frsky_x.c.