Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
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)
#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.

Referenced by buildTelemetryFrame().

◆ SEQUENCE_MARKER_REMOTE_PART

#define SEQUENCE_MARKER_REMOTE_PART   0xf0

Definition at line 130 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame().

◆ TELEMETRY_DATA_SIZE

#define TELEMETRY_DATA_SIZE   5

Definition at line 132 of file cc2500_frsky_x.c.

Referenced by appendSmartPortData().

◆ TELEMETRY_FRAME_SIZE

#define TELEMETRY_FRAME_SIZE   sizeof(telemetryData_t)

Definition at line 144 of file cc2500_frsky_x.c.

Referenced by buildTelemetryFrame(), and frSkyXHandlePacket().

◆ TELEMETRY_OUT_BUFFER_SIZE

#define TELEMETRY_OUT_BUFFER_SIZE   64

◆ TELEMETRY_SEQUENCE_LENGTH

#define TELEMETRY_SEQUENCE_LENGTH   4

Definition at line 112 of file cc2500_frsky_x.c.

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

◆ UNUSED

#define UNUSED ( x)
Value:
(void)(x)

Definition at line 12 of file cc2500_frsky_x.c.

Referenced by act_feedback_cb(), actuators_dualpwm_set(), actuators_faulhaber_set(), ahrs_dcm_update_gps(), autopilot_in_flight_end_detection(), cam_gimbal_ac_target(), cam_gimbal_joystick(), can_frame_cb(), dc_set_expo(), detection_cb(), dqrlss(), empty_approaching(), empty_circle(), empty_goto(), empty_oval(), empty_route(), frSkyXProcessFrame(), gps_cb(), guidance_hybrid_h_run_accel(), guidance_hybrid_h_run_pos(), guidance_hybrid_h_run_speed(), guidance_indi_calcG_zyx(), guidance_indi_controller(), guidance_indi_controller(), guidance_indi_get_liftd(), guidance_indi_get_liftd(), guidance_indi_run_mode(), guidance_pid_h_run_accel(), guidance_pid_v_run_accel(), guidance_plane_attitude_from_nav(), guidance_v_run_accel(), guidance_v_run_pos(), guidance_v_run_speed(), i2c_arch_init(), ins_act_feedback_cb(), ins_optical_flow_cb(), joystick_cb(), lwc_cb(), lwc_cb(), lwc_cb(), mt9f002_setting_update_color(), mt9f002_setting_update_exposure(), mt9f002_setting_update_resolution(), multi_ranger_boot_device(), multi_ranger_read(), nav_advance_carrot(), nav_land_at_loc(), nav_land_at_wp(), nav_land_here(), nav_takeoff_from_loc(), ofh_optical_flow_cb(), persistent_read(), persistent_write(), processSmartPortTelemetry(), qr_solve(), rc_cb(), rc_cb(), rc_cb(), recursive_least_squares(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), reset_cb(), rotwing_state_feedback_cb(), send_rotorcraft_cmd(), send_tune_hover(), send_uartx_err(), spektrum_bind(), stabilization_attitude_run(), stabilization_direct_run(), stabilization_indi_get_actuator_state(), stabilization_opticflow_vel_cb(), sys_id_chirp_add_values(), sys_id_doublet_add_values(), syslink_check_free_space(), syslink_put_buffer(), syslink_send_message(), tag_track_cb(), texton_func(), ubx_send_cfg_rst(), update_wp(), vertical_ctrl_agl_cb(), vertical_ctrl_optical_flow_cb(), wing_position_cb(), wing_position_cb(), wing_position_cb(), wing_position_cb(), and wls_alloc().

Typedef Documentation

◆ telemetryBuffer_t

◆ telemetryData_t

◆ telemetryPayload_t

◆ telemetrySequenceMarker_t

◆ telemetrySequenceMarkerData_t

Function Documentation

◆ appendSmartPortData()

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()

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

Definition at line 180 of file cc2500_frsky_x.c.

References crcTable.

Referenced by buildTelemetryFrame(), and isValidPacket().

Here is the caller graph for this function:

◆ frSkyXCheckQueueEmpty()

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)

Definition at line 544 of file cc2500_frsky_x.c.

References frSkyXCheckQueueEmpty(), millis, processSmartPortTelemetry(), remoteToProcessId, remoteToProcessIndex, RX_SPI_RECEIVED_NONE, smartPortDataReceive(), TELEMETRY_SEQUENCE_LENGTH, telemetryRxBuffer, and UNUSED.

Referenced by frSkySpiInit().

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

◆ frSkyXSetRcData()

void frSkyXSetRcData ( uint16_t * rcData,
const uint8_t * packet )

Definition at line 304 of file cc2500_frsky_x.c.

References rcData.

Referenced by frSkySpiInit().

Here is the caller graph for this function:

◆ frSkyXTelemetrySendByte()

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

Referenced by frSkyXTelemetryWriteFrame().

Here is the caller graph for this function:

◆ frSkyXTelemetryWriteFrame()

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().