PX4 Firmware
PX4 Autopilot Software http://px4.io
frsky_telemetry.cpp File Reference
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <poll.h>
#include <fcntl.h>
#include <unistd.h>
#include <px4_platform_common/tasks.h>
#include <px4_platform_common/module.h>
#include <px4_platform_common/getopt.h>
#include <systemlib/err.h>
#include <termios.h>
#include <drivers/drv_hrt.h>
#include <uORB/topics/vehicle_air_data.h>
#include <math.h>
#include "sPort_data.h"
#include "frsky_data.h"
#include "common.h"
Include dependency graph for frsky_telemetry.cpp:

Go to the source code of this file.

Enumerations

enum  frsky_state_t { SCANNING, SPORT, SPORT_SINGLE_WIRE, DTYPE }
 

Functions

static int sPort_open_uart (const char *uart_name, struct termios *uart_config, struct termios *uart_config_original)
 Opens the UART device and sets all required serial parameters. More...
 
static int set_uart_speed (int uart, struct termios *uart_config, speed_t speed)
 
static void usage ()
 Print command usage information. More...
 
static int frsky_telemetry_thread_main (int argc, char *argv[])
 The daemon thread. More...
 
__EXPORT int frsky_telemetry_main (int argc, char *argv[])
 The main command function. More...
 
uint16_t get_telemetry_flight_mode (int px4_flight_mode)
 Map the PX4 flight mode (vehicle_status_s::nav_state) to the telemetry flight mode. More...
 
static void set_uart_single_wire (int uart, bool single_wire)
 

Variables

static volatile bool thread_should_exit = false
 
static volatile bool thread_running = false
 
static int frsky_task
 
static frsky_state_t frsky_state = SCANNING
 
static unsigned long int sentPackets = 0
 
const char * device_name = NULL
 

Enumeration Type Documentation

◆ frsky_state_t

Enumerator
SCANNING 
SPORT 
SPORT_SINGLE_WIRE 
DTYPE 

Definition at line 79 of file frsky_telemetry.cpp.

Function Documentation

◆ frsky_telemetry_main()

int frsky_telemetry_main ( int  argc,
char *  argv[] 
)

The main command function.

Processes command line arguments and starts the daemon.

Definition at line 701 of file frsky_telemetry.cpp.

References device_name, DTYPE, frsky_state, frsky_task, frsky_telemetry_thread_main(), SCANNING, sentPackets, SPORT, SPORT_SINGLE_WIRE, thread_running, thread_should_exit, and usage().

Here is the call graph for this function:

◆ frsky_telemetry_thread_main()

static int frsky_telemetry_thread_main ( int  argc,
char *  argv[] 
)
static

The daemon thread.

Definition at line 213 of file frsky_telemetry.cpp.

References adc_linkquality::ad1, adc_linkquality::ad2, vehicle_air_data_s::baro_alt_meter, device_name, dt, DTYPE, f(), frsky_deinit(), frsky_init(), frsky_parse_host(), frsky_send_frame1(), frsky_send_frame2(), frsky_send_frame3(), frsky_state, frsky_update_topics(), hrt_absolute_time(), hrt_abstime, adc_linkquality::linkq, orb_check(), orb_copy(), ORB_ID, orb_subscribe(), read(), SCANNING, sentPackets, set_uart_single_wire(), set_uart_speed(), SMARTPORT_POLL_1, SMARTPORT_POLL_2, SMARTPORT_POLL_3, SMARTPORT_POLL_4, SMARTPORT_POLL_5, SMARTPORT_POLL_6, SMARTPORT_POLL_7, SMARTPORT_POLL_8, SMARTPORT_SENSOR_ID_SP2UR, SPORT, sPort_deinit(), sPort_init(), sPort_open_uart(), sPort_send_ALT(), sPort_send_BATV(), sPort_send_CUR(), sPort_send_flight_mode(), sPort_send_FUEL(), sPort_send_GPS_ALT(), sPort_send_GPS_CRS(), sPort_send_GPS_FIX(), sPort_send_GPS_info(), sPort_send_GPS_LAT(), sPort_send_GPS_LON(), sPort_send_GPS_SPD(), sPort_send_GPS_TIME(), sPort_send_NAV_STATE(), sPort_send_SPD(), sPort_send_VSPD(), SPORT_SINGLE_WIRE, sPort_update_topics(), status, thread_running, thread_should_exit, and usage().

Referenced by frsky_telemetry_main().

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

◆ get_telemetry_flight_mode()

uint16_t get_telemetry_flight_mode ( int  px4_flight_mode)

Map the PX4 flight mode (vehicle_status_s::nav_state) to the telemetry flight mode.

Definition at line 94 of file frsky_telemetry.cpp.

Referenced by frsky_send_frame1(), and sPort_send_flight_mode().

Here is the caller graph for this function:

◆ set_uart_single_wire()

static void set_uart_single_wire ( int  uart,
bool  single_wire 
)
static

Definition at line 203 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_thread_main().

Here is the caller graph for this function:

◆ set_uart_speed()

static int set_uart_speed ( int  uart,
struct termios *  uart_config,
speed_t  speed 
)
static

Definition at line 189 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_thread_main().

Here is the caller graph for this function:

◆ sPort_open_uart()

static int sPort_open_uart ( const char *  uart_name,
struct termios *  uart_config,
struct termios *  uart_config_original 
)
static

Opens the UART device and sets all required serial parameters.

Definition at line 135 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_thread_main().

Here is the caller graph for this function:

◆ usage()

static void usage ( void  )
static

Print command usage information.

Definition at line 796 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main(), and frsky_telemetry_thread_main().

Here is the caller graph for this function:

Variable Documentation

◆ device_name

const char* device_name = NULL

◆ frsky_state

frsky_state_t frsky_state = SCANNING
static

Definition at line 80 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main(), and frsky_telemetry_thread_main().

◆ frsky_task

int frsky_task
static

Definition at line 78 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main().

◆ sentPackets

unsigned long int sentPackets = 0
static

Definition at line 82 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main(), and frsky_telemetry_thread_main().

◆ thread_running

volatile bool thread_running = false
static

Definition at line 77 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main(), and frsky_telemetry_thread_main().

◆ thread_should_exit

volatile bool thread_should_exit = false
static

Definition at line 76 of file frsky_telemetry.cpp.

Referenced by frsky_telemetry_main(), and frsky_telemetry_thread_main().