PX4 Firmware
PX4 Autopilot Software http://px4.io
sPort_data.h File Reference
#include <sys/types.h>
#include <stdbool.h>
Include dependency graph for sPort_data.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SMARTPORT_POLL_1   0x1B
 
#define SMARTPORT_POLL_2   0x34
 
#define SMARTPORT_POLL_3   0x95
 
#define SMARTPORT_POLL_4   0x16
 
#define SMARTPORT_POLL_5   0xB7
 
#define SMARTPORT_POLL_6   0x00
 
#define SMARTPORT_POLL_7   0x83
 
#define SMARTPORT_POLL_8   0xBA
 
#define SMARTPORT_SENSOR_ID_SP2UR   0xC6
 
#define SMARTPORT_ID_RSSI   0xf101
 
#define SMARTPORT_ID_RXA1   0xf102
 
#define SMARTPORT_ID_RXA2   0xf103
 
#define SMARTPORT_ID_BATV   0xf104
 
#define SMARTPORT_ID_SWR   0xf105
 
#define SMARTPORT_ID_T1   0x0400
 
#define SMARTPORT_ID_T2   0x0410
 
#define SMARTPORT_ID_RPM   0x0500
 
#define SMARTPORT_ID_FUEL   0x0600
 
#define SMARTPORT_ID_ALT   0x0100
 
#define SMARTPORT_ID_VARIO   0x0110
 
#define SMARTPORT_ID_ACCX   0x0700
 
#define SMARTPORT_ID_ACCY   0x0710
 
#define SMARTPORT_ID_ACCZ   0x0720
 
#define SMARTPORT_ID_CURR   0x0200
 
#define SMARTPORT_ID_VFAS   0x0210
 
#define SMARTPORT_ID_CELLS   0x0300
 
#define SMARTPORT_ID_GPS_LON_LAT   0x0800
 
#define SMARTPORT_ID_GPS_ALT   0x0820
 
#define SMARTPORT_ID_GPS_SPD   0x0830
 
#define SMARTPORT_ID_GPS_CRS   0x0840
 
#define SMARTPORT_ID_GPS_TIME   0x0850
 
#define SMARTPORT_ID_DIY_FIRST   0x5000
 
#define SMARTPORT_ID_DIY_LAST   0x50ff
 
#define SMARTPORT_ID_DIY_NAVSTATE   0x5000
 
#define SMARTPORT_ID_DIY_GPSFIX   0x5001
 

Functions

bool sPort_init (void)
 Initializes the uORB subscriptions. More...
 
void sPort_deinit (void)
 
void sPort_update_topics (void)
 
void sPort_send_data (int uart, uint16_t id, uint32_t data)
 Sends one data id/value pair. More...
 
void sPort_send_BATV (int uart)
 
void sPort_send_CUR (int uart)
 
void sPort_send_ALT (int uart)
 
void sPort_send_SPD (int uart)
 
void sPort_send_VSPD (int uart, float speed)
 
void sPort_send_FUEL (int uart)
 
void sPort_send_GPS_LON (int uart)
 
void sPort_send_GPS_LAT (int uart)
 
void sPort_send_GPS_ALT (int uart)
 
void sPort_send_GPS_SPD (int uart)
 
void sPort_send_GPS_CRS (int uart)
 
void sPort_send_GPS_TIME (int uart)
 
void sPort_send_flight_mode (int uart)
 
void sPort_send_GPS_info (int uart)
 
void sPort_send_NAV_STATE (int uart)
 
void sPort_send_GPS_FIX (int uart)
 

Detailed Description

Author
Mark Whitehorn kd0ai.nosp@m.j@gi.nosp@m.thub..nosp@m.com

FrSky SmartPort telemetry implementation.

Definition in file sPort_data.h.

Macro Definition Documentation

◆ SMARTPORT_ID_ACCX

#define SMARTPORT_ID_ACCX   0x0700

Definition at line 71 of file sPort_data.h.

◆ SMARTPORT_ID_ACCY

#define SMARTPORT_ID_ACCY   0x0710

Definition at line 72 of file sPort_data.h.

◆ SMARTPORT_ID_ACCZ

#define SMARTPORT_ID_ACCZ   0x0720

Definition at line 73 of file sPort_data.h.

◆ SMARTPORT_ID_ALT

#define SMARTPORT_ID_ALT   0x0100

Definition at line 69 of file sPort_data.h.

Referenced by sPort_send_ALT().

◆ SMARTPORT_ID_BATV

#define SMARTPORT_ID_BATV   0xf104

Definition at line 63 of file sPort_data.h.

◆ SMARTPORT_ID_CELLS

#define SMARTPORT_ID_CELLS   0x0300

Definition at line 76 of file sPort_data.h.

◆ SMARTPORT_ID_CURR

#define SMARTPORT_ID_CURR   0x0200

Definition at line 74 of file sPort_data.h.

Referenced by sPort_send_CUR().

◆ SMARTPORT_ID_DIY_FIRST

#define SMARTPORT_ID_DIY_FIRST   0x5000

Definition at line 82 of file sPort_data.h.

◆ SMARTPORT_ID_DIY_GPSFIX

#define SMARTPORT_ID_DIY_GPSFIX   0x5001

Definition at line 85 of file sPort_data.h.

Referenced by sPort_send_GPS_FIX().

◆ SMARTPORT_ID_DIY_LAST

#define SMARTPORT_ID_DIY_LAST   0x50ff

Definition at line 83 of file sPort_data.h.

◆ SMARTPORT_ID_DIY_NAVSTATE

#define SMARTPORT_ID_DIY_NAVSTATE   0x5000

Definition at line 84 of file sPort_data.h.

Referenced by sPort_send_NAV_STATE().

◆ SMARTPORT_ID_FUEL

#define SMARTPORT_ID_FUEL   0x0600

Definition at line 68 of file sPort_data.h.

Referenced by sPort_send_FUEL().

◆ SMARTPORT_ID_GPS_ALT

#define SMARTPORT_ID_GPS_ALT   0x0820

Definition at line 78 of file sPort_data.h.

Referenced by sPort_send_GPS_ALT().

◆ SMARTPORT_ID_GPS_CRS

#define SMARTPORT_ID_GPS_CRS   0x0840

Definition at line 80 of file sPort_data.h.

Referenced by sPort_send_GPS_CRS().

◆ SMARTPORT_ID_GPS_LON_LAT

#define SMARTPORT_ID_GPS_LON_LAT   0x0800

Definition at line 77 of file sPort_data.h.

Referenced by sPort_send_GPS_LAT(), and sPort_send_GPS_LON().

◆ SMARTPORT_ID_GPS_SPD

#define SMARTPORT_ID_GPS_SPD   0x0830

Definition at line 79 of file sPort_data.h.

Referenced by sPort_send_GPS_SPD(), and sPort_send_SPD().

◆ SMARTPORT_ID_GPS_TIME

#define SMARTPORT_ID_GPS_TIME   0x0850

Definition at line 81 of file sPort_data.h.

Referenced by sPort_send_GPS_TIME().

◆ SMARTPORT_ID_RPM

#define SMARTPORT_ID_RPM   0x0500

Definition at line 67 of file sPort_data.h.

◆ SMARTPORT_ID_RSSI

#define SMARTPORT_ID_RSSI   0xf101

Definition at line 60 of file sPort_data.h.

◆ SMARTPORT_ID_RXA1

#define SMARTPORT_ID_RXA1   0xf102

Definition at line 61 of file sPort_data.h.

◆ SMARTPORT_ID_RXA2

#define SMARTPORT_ID_RXA2   0xf103

Definition at line 62 of file sPort_data.h.

◆ SMARTPORT_ID_SWR

#define SMARTPORT_ID_SWR   0xf105

Definition at line 64 of file sPort_data.h.

◆ SMARTPORT_ID_T1

#define SMARTPORT_ID_T1   0x0400

Definition at line 65 of file sPort_data.h.

◆ SMARTPORT_ID_T2

#define SMARTPORT_ID_T2   0x0410

Definition at line 66 of file sPort_data.h.

◆ SMARTPORT_ID_VARIO

#define SMARTPORT_ID_VARIO   0x0110

Definition at line 70 of file sPort_data.h.

Referenced by sPort_send_VSPD().

◆ SMARTPORT_ID_VFAS

#define SMARTPORT_ID_VFAS   0x0210

Definition at line 75 of file sPort_data.h.

Referenced by sPort_send_BATV().

◆ SMARTPORT_POLL_1

#define SMARTPORT_POLL_1   0x1B

Definition at line 49 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_2

#define SMARTPORT_POLL_2   0x34

Definition at line 50 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_3

#define SMARTPORT_POLL_3   0x95

Definition at line 51 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_4

#define SMARTPORT_POLL_4   0x16

Definition at line 52 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_5

#define SMARTPORT_POLL_5   0xB7

Definition at line 53 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_6

#define SMARTPORT_POLL_6   0x00

Definition at line 54 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_7

#define SMARTPORT_POLL_7   0x83

Definition at line 55 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_POLL_8

#define SMARTPORT_POLL_8   0xBA

Definition at line 56 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

◆ SMARTPORT_SENSOR_ID_SP2UR

#define SMARTPORT_SENSOR_ID_SP2UR   0xC6

Definition at line 57 of file sPort_data.h.

Referenced by frsky_telemetry_thread_main().

Function Documentation

◆ sPort_deinit()

void sPort_deinit ( void  )

Definition at line 94 of file sPort_data.cpp.

References s_port_subscription_data.

Referenced by frsky_telemetry_thread_main().

Here is the caller graph for this function:

◆ sPort_init()

bool sPort_init ( void  )

Initializes the uORB subscriptions.

Definition at line 83 of file sPort_data.cpp.

Referenced by frsky_telemetry_thread_main().

Here is the caller graph for this function:

◆ sPort_send_ALT()

void sPort_send_ALT ( int  uart)

Definition at line 197 of file sPort_data.cpp.

References vehicle_air_data_s::baro_alt_meter, uORB::SubscriptionData< T >::get(), SMARTPORT_ID_ALT, sPort_send_data(), and s_port_subscription_data_s::vehicle_air_data_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_BATV()

void sPort_send_BATV ( int  uart)

Definition at line 179 of file sPort_data.cpp.

References s_port_subscription_data_s::battery_status_sub, uORB::SubscriptionData< T >::get(), SMARTPORT_ID_VFAS, sPort_send_data(), and battery_status_s::voltage_v.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_CUR()

void sPort_send_CUR ( int  uart)

Definition at line 187 of file sPort_data.cpp.

References s_port_subscription_data_s::battery_status_sub, battery_status_s::current_a, uORB::SubscriptionData< T >::get(), SMARTPORT_ID_CURR, and sPort_send_data().

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_data()

void sPort_send_data ( int  uart,
uint16_t  id,
uint32_t  data 
)

Sends one data id/value pair.

Definition at line 146 of file sPort_data.cpp.

References data, sPort_send_byte(), update_crc(), and write().

Referenced by 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(), and sPort_send_VSPD().

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

◆ sPort_send_flight_mode()

void sPort_send_flight_mode ( int  uart)

Definition at line 330 of file sPort_data.cpp.

References FRSKY_ID_TEMP1, uORB::SubscriptionData< T >::get(), get_telemetry_flight_mode(), vehicle_status_s::nav_state, sPort_send_data(), and s_port_subscription_data_s::vehicle_status_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_FUEL()

void sPort_send_FUEL ( int  uart)

Definition at line 224 of file sPort_data.cpp.

References s_port_subscription_data_s::battery_status_sub, uORB::SubscriptionData< T >::get(), battery_status_s::remaining, SMARTPORT_ID_FUEL, and sPort_send_data().

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_ALT()

void sPort_send_GPS_ALT ( int  uart)

Definition at line 256 of file sPort_data.cpp.

References vehicle_gps_position_s::alt, uORB::SubscriptionData< T >::get(), SMARTPORT_ID_GPS_ALT, sPort_send_data(), and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_CRS()

void sPort_send_GPS_CRS ( int  uart)

Definition at line 263 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), M_PI_F, SMARTPORT_ID_GPS_CRS, sPort_send_data(), s_port_subscription_data_s::vehicle_local_position_sub, and vehicle_local_position_s::yaw.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_FIX()

void sPort_send_GPS_FIX ( int  uart)

Definition at line 321 of file sPort_data.cpp.

References vehicle_gps_position_s::fix_type, uORB::SubscriptionData< T >::get(), vehicle_gps_position_s::satellites_used, SMARTPORT_ID_DIY_GPSFIX, sPort_send_data(), t2, and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_info()

void sPort_send_GPS_info ( int  uart)

Definition at line 337 of file sPort_data.cpp.

References vehicle_gps_position_s::fix_type, FRSKY_ID_TEMP2, uORB::SubscriptionData< T >::get(), gps, vehicle_gps_position_s::satellites_used, sPort_send_data(), and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_LAT()

void sPort_send_GPS_LAT ( int  uart)

Definition at line 245 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), vehicle_gps_position_s::lat, SMARTPORT_ID_GPS_LON_LAT, sPort_send_data(), and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_LON()

void sPort_send_GPS_LON ( int  uart)

Definition at line 231 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), vehicle_gps_position_s::lon, SMARTPORT_ID_GPS_LON_LAT, sPort_send_data(), and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_SPD()

void sPort_send_GPS_SPD ( int  uart)

Definition at line 298 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), SMARTPORT_ID_GPS_SPD, sPort_send_data(), s_port_subscription_data_s::vehicle_global_position_sub, vehicle_global_position_s::vel_e, and vehicle_global_position_s::vel_n.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_GPS_TIME()

void sPort_send_GPS_TIME ( int  uart)

Definition at line 275 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), SMARTPORT_ID_GPS_TIME, sPort_send_data(), vehicle_gps_position_s::time_utc_usec, and s_port_subscription_data_s::vehicle_gps_position_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_NAV_STATE()

void sPort_send_NAV_STATE ( int  uart)

Definition at line 311 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), vehicle_status_s::nav_state, SMARTPORT_ID_DIY_NAVSTATE, sPort_send_data(), and s_port_subscription_data_s::vehicle_status_sub.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_SPD()

void sPort_send_SPD ( int  uart)

Definition at line 205 of file sPort_data.cpp.

References uORB::SubscriptionData< T >::get(), SMARTPORT_ID_GPS_SPD, sPort_send_data(), s_port_subscription_data_s::vehicle_global_position_sub, vehicle_global_position_s::vel_e, and vehicle_global_position_s::vel_n.

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_send_VSPD()

void sPort_send_VSPD ( int  uart,
float  speed 
)

Definition at line 216 of file sPort_data.cpp.

References SMARTPORT_ID_VARIO, and sPort_send_data().

Referenced by frsky_telemetry_thread_main().

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

◆ sPort_update_topics()

void sPort_update_topics ( void  )

Definition at line 102 of file sPort_data.cpp.

References s_port_subscription_data_s::battery_status_sub, s_port_subscription_data_s::sensor_combined_sub, uORB::SubscriptionData< T >::update(), s_port_subscription_data_s::vehicle_air_data_sub, s_port_subscription_data_s::vehicle_global_position_sub, s_port_subscription_data_s::vehicle_gps_position_sub, s_port_subscription_data_s::vehicle_local_position_sub, and s_port_subscription_data_s::vehicle_status_sub.

Referenced by frsky_telemetry_thread_main().

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