Paparazzi UAS  v5.18.0_stable
Paparazzi is a free software Unmanned Aircraft System.
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

◆ telemetrySequenceMarkerData_s

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

◆ telemetrySequenceMarker_s

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

◆ telemetryData_s

struct telemetryData_s

Definition at line 134 of file cc2500_frsky_x.c.

Data Fields
uint8_t data[TELEMETRY_DATA_SIZE]
uint8_t dataLength

◆ telemetryBuffer_s

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

◆ telemetryPayload_s

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

◆ A1_CONST_X

#define A1_CONST_X   50

Definition at line 114 of file cc2500_frsky_x.c.

◆ SEQUENCE_MARKER_REMOTE_PART

#define SEQUENCE_MARKER_REMOTE_PART   0xf0

Definition at line 130 of file cc2500_frsky_x.c.

◆ TELEMETRY_DATA_SIZE

#define TELEMETRY_DATA_SIZE   5

Definition at line 132 of file cc2500_frsky_x.c.

◆ TELEMETRY_FRAME_SIZE

#define TELEMETRY_FRAME_SIZE   sizeof(telemetryData_t)

Definition at line 144 of file cc2500_frsky_x.c.

◆ TELEMETRY_OUT_BUFFER_SIZE

#define TELEMETRY_OUT_BUFFER_SIZE   64

Definition at line 110 of file cc2500_frsky_x.c.

◆ TELEMETRY_SEQUENCE_LENGTH

#define TELEMETRY_SEQUENCE_LENGTH   4

Definition at line 112 of file cc2500_frsky_x.c.

◆ UNUSED

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

Definition at line 12 of file cc2500_frsky_x.c.

Typedef Documentation

◆ telemetryBuffer_t

◆ telemetryData_t

◆ telemetryPayload_t

◆ telemetrySequenceMarker_t

◆ telemetrySequenceMarkerData_t

Function Documentation

◆ appendSmartPortData()

static uint8_t appendSmartPortData ( uint8_t buf)
static

Definition at line 190 of file cc2500_frsky_x.c.

References TELEMETRY_DATA_SIZE, TELEMETRY_OUT_BUFFER_SIZE, telemetryOutBuffer, and telemetryOutWriter.

Referenced by buildTelemetryFrame().

+ Here is the caller graph for this function:

◆ buildTelemetryFrame()

◆ calculateCrc()

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

Definition at line 180 of file cc2500_frsky_x.c.

References crc, and crcTable.

Referenced by buildTelemetryFrame(), and isValidPacket().

+ Here is the caller graph for this function:

◆ frSkyXCheckQueueEmpty()

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:

◆ frSkyXHandlePacket()

◆ frSkyXInit()

void frSkyXInit ( const rx_spi_protocol_e  spiProtocol)

Definition at line 582 of file cc2500_frsky_x.c.

References FEATURE_TELEMETRY, featureIsEnabled, frSkyXTelemetryWriteFrame(), initSmartPortTelemetryExternal(), packetLength, RX_SPI_FRSKY_X, RX_SPI_FRSKY_X_LBT, spiProtocol, telemetryDelayUs, and telemetryEnabled.

Referenced by frSkySpiInit().

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

◆ frSkyXProcessFrame()

rx_spi_received_e frSkyXProcessFrame ( uint8_t *const  packet)

◆ frSkyXSetRcData()

void frSkyXSetRcData ( uint16_t rcData,
const uint8_t packet 
)

Definition at line 304 of file cc2500_frsky_x.c.

References c(), and rcData.

Referenced by frSkySpiInit().

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

◆ frSkyXTelemetrySendByte()

static void frSkyXTelemetrySendByte ( uint8_t  c)
static

Definition at line 277 of file cc2500_frsky_x.c.

References c(), FSSP_DLE, FSSP_DLE_XOR, FSSP_START_STOP, TELEMETRY_OUT_BUFFER_SIZE, telemetryOutBuffer, and telemetryOutWriter.

Referenced by frSkyXTelemetryWriteFrame().

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

◆ frSkyXTelemetryWriteFrame()

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, telemetryOutBuffer, and telemetryOutWriter.

Referenced by frSkyXInit().

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

◆ isValidPacket()

bool isValidPacket ( const uint8_t packet)

Definition at line 327 of file cc2500_frsky_x.c.

References calculateCrc(), packetLength, and rxCc2500SpiConfig().

Referenced by frSkyXHandlePacket().

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

Variable Documentation

◆ crcTable

const uint16_t crcTable[]

Definition at line 75 of file cc2500_frsky_x.c.

Referenced by calculateCrc().

◆ frame

◆ packetLength

uint8_t packetLength
static

Definition at line 177 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), frSkyXInit(), and isValidPacket().

◆ remoteToProcessId

uint8_t remoteToProcessId = 0
static

Definition at line 172 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), and frSkyXProcessFrame().

◆ remoteToProcessIndex

uint8_t remoteToProcessIndex = 0
static

Definition at line 173 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), and frSkyXProcessFrame().

◆ responseToSend

telemetrySequenceMarker_t responseToSend
static

Definition at line 160 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame(), and frSkyXHandlePacket().

◆ telemetryDelayUs

uint16_t telemetryDelayUs
static

Definition at line 178 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), and frSkyXInit().

◆ telemetryEnabled

bool telemetryEnabled = false
static

Definition at line 170 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), and frSkyXInit().

◆ telemetryOutBuffer

uint8_t telemetryOutBuffer[TELEMETRY_OUT_BUFFER_SIZE]
static

◆ telemetryOutWriter

uint8_t telemetryOutWriter
static

◆ telemetryRxBuffer

telemetryBuffer_t telemetryRxBuffer[TELEMETRY_SEQUENCE_LENGTH]
static

Definition at line 158 of file cc2500_frsky_x.c.

Referenced by frSkyXHandlePacket(), and frSkyXProcessFrame().

◆ telemetryTxBuffer

telemetryData_t telemetryTxBuffer[TELEMETRY_SEQUENCE_LENGTH]
static

Definition at line 155 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame().