Paparazzi UAS v7.1_unstable
Paparazzi is a free software Unmanned Aircraft System.
Loading...
Searching...
No Matches
nps_radio_control_spektrum.c File Reference
#include "nps_radio_control_spektrum.h"
#include "nps_radio_control.h"
#include <glib.h>
#include <stdio.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <errno.h>
#include <inttypes.h>
Include dependency graph for nps_radio_control_spektrum.c:

Go to the source code of this file.

Macros

#define IUCLC   0
#define CHANNEL_OF_FRAME(i)
#define SYNC_1   0x03
#define SYNC_2   0x12
#define STA_UNINIT   0
#define STA_GOT_SYNC_1   1
#define STA_GOT_SYNC_2   2
#define FRAME_LEN   14

Functions

static gboolean on_serial_data_received (GIOChannel *source, GIOCondition condition, gpointer data)
static void parse_data (char *buf, int len)
static void handle_frame (void)
int nps_radio_control_spektrum_init (const char *device)

Variables

static int sp_fd
uint8_t status = STA_UNINIT
static uint8_t frame_buf [FRAME_LEN]
static uint32_t idx = 0

Macro Definition Documentation

◆ CHANNEL_OF_FRAME

#define CHANNEL_OF_FRAME ( i)
Value:
((((frame_buf[2*i]<<8) + frame_buf[2*i+1])&0x03FF)-512)
static uint8_t frame_buf[FRAME_LEN]

Definition at line 20 of file nps_radio_control_spektrum.c.

Referenced by handle_frame().

◆ FRAME_LEN

#define FRAME_LEN   14

Definition at line 103 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ IUCLC

#define IUCLC   0

Definition at line 17 of file nps_radio_control_spektrum.c.

◆ STA_GOT_SYNC_1

#define STA_GOT_SYNC_1   1

Definition at line 98 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ STA_GOT_SYNC_2

#define STA_GOT_SYNC_2   2

Definition at line 99 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ STA_UNINIT

#define STA_UNINIT   0

Definition at line 97 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ SYNC_1

#define SYNC_1   0x03

Definition at line 94 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ SYNC_2

#define SYNC_2   0x12

Definition at line 95 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

Function Documentation

◆ handle_frame()

void handle_frame ( void )
static

Definition at line 141 of file nps_radio_control_spektrum.c.

References CHANNEL_OF_FRAME, and nps_radio_control.

Referenced by parse_data().

Here is the caller graph for this function:

◆ nps_radio_control_spektrum_init()

int nps_radio_control_spektrum_init ( const char * device)

Definition at line 31 of file nps_radio_control_spektrum.c.

References B115200, IUCLC, on_serial_data_received(), and sp_fd.

Referenced by nps_radio_control_init().

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

◆ on_serial_data_received()

gboolean on_serial_data_received ( GIOChannel * source,
GIOCondition condition,
gpointer data )
static

Definition at line 74 of file nps_radio_control_spektrum.c.

References parse_data(), and TRUE.

Referenced by nps_radio_control_spektrum_init().

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

◆ parse_data()

void parse_data ( char * buf,
int len )
static

Definition at line 107 of file nps_radio_control_spektrum.c.

References frame_buf, FRAME_LEN, handle_frame(), idx, STA_GOT_SYNC_1, STA_GOT_SYNC_2, STA_UNINIT, status, SYNC_1, and SYNC_2.

Referenced by on_serial_data_received().

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

Variable Documentation

◆ frame_buf

uint8_t frame_buf[FRAME_LEN]
static

Definition at line 104 of file nps_radio_control_spektrum.c.

Referenced by parse_data().

◆ idx

uint32_t idx = 0
static

Definition at line 105 of file nps_radio_control_spektrum.c.

Referenced by act_feedback_cb(), actuators_asctec_v2_set(), actuators_bebop_set(), actuators_disco_set(), actuators_dshot_set(), actuators_dualpwm_set(), actuators_faulhaber_set(), actuators_md25_set(), actuators_ostrich_set(), actuators_pwm_set(), actuators_sbus_set(), actuators_spektrum_set(), actuators_sts3032_set(), actuators_t4_set(), actuators_uavcan1_set(), actuators_uavcan1cmd_set(), actuators_uavcan2_set(), actuators_uavcan2cmd_set(), actuators_uavcan_next_telem(), air_data_next(), attitude_ref_quat_float_idx_set_omega_p(), attitude_ref_quat_float_idx_set_omega_q(), attitude_ref_quat_float_idx_set_omega_r(), attitude_ref_quat_float_schedule(), baro_cb(), calculate_edge_histogram(), cloud_sensor_callback(), dshotTlmRec(), esc32_get_float(), find_launch_index(), get_actuator_idx(), get_actuator_telem(), image_gradient_pixel(), image_show_points_color(), jpeg_huffman(), mavlink_common_message_handler(), mtostk_populate_float_array_from_buffer(), mtostk_populate_uuid_from_buffer(), osd_put_s(), parse_data(), pfc_act_feedback_cb(), pfc_actuators_value(), power_uavcan_send_power_device(), px4flow_i2c_periodic(), radio_control_get(), radio_control_set(), range_msg_callback(), rm3100_get_raw_from_buf(), rotwing_state_feedback_cb(), rpm_cb(), send_airspeed_raw(), send_baro_raw(), send_gps_relpos(), settings_send_dl_value(), slcan_can_rx_cb(), spi_submit(), stabilization_attitude_gain_schedule(), superbitrf_gen_dsmx_channels(), and vn200_read_message().

◆ sp_fd

int sp_fd
static

Definition at line 22 of file nps_radio_control_spektrum.c.

Referenced by nps_radio_control_spektrum_init().

◆ status

uint8_t status = STA_UNINIT

Definition at line 101 of file nps_radio_control_spektrum.c.